Skip to content

fix error prone failure path in GetTypeFromScope#826

Merged
aaronj0 merged 1 commit intocompiler-research:mainfrom
aaronj0:gettype-failure-path
Mar 1, 2026
Merged

fix error prone failure path in GetTypeFromScope#826
aaronj0 merged 1 commit intocompiler-research:mainfrom
aaronj0:gettype-failure-path

Conversation

@aaronj0
Copy link
Copy Markdown
Collaborator

@aaronj0 aaronj0 commented Feb 27, 2026

The earlier path forced a cast to TypeDecl, which will assert if that's not a valid cast, eg. if you have a NamespaceDecl.

llvm/include/llvm/Support/Casting.h:578: decltype(auto) llvm::cast(From*) [with To = clang::TypeDecl; From = clang::Decl]: Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed.

Allows for more flexible calls from cppyy, being less crash-prone. The old test has been extended.

@aaronj0 aaronj0 requested a review from vgvassilev February 27, 2026 13:47
@aaronj0 aaronj0 force-pushed the gettype-failure-path branch 2 times, most recently from 97725bd to d178ffa Compare February 27, 2026 13:49
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.56%. Comparing base (ab4ca85) to head (af012a2).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #826   +/-   ##
=======================================
  Coverage   79.56%   79.56%           
=======================================
  Files          11       11           
  Lines        4012     4013    +1     
=======================================
+ Hits         3192     3193    +1     
  Misses        820      820           
Files with missing lines Coverage Δ
lib/CppInterOp/CppInterOp.cpp 87.86% <100.00%> (+<0.01%) ⬆️
Files with missing lines Coverage Δ
lib/CppInterOp/CppInterOp.cpp 87.86% <100.00%> (+<0.01%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

@aaronj0 aaronj0 force-pushed the gettype-failure-path branch from d178ffa to 6f4bf5f Compare February 27, 2026 14:35
Copy link
Copy Markdown
Contributor

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@aaronj0 aaronj0 force-pushed the gettype-failure-path branch from 6f4bf5f to 0553d80 Compare February 28, 2026 15:38
The earlier path forced a cast to TypeDecl, which will assert if that's not a valid cast, eg. if you have a NamespaceDecl.

```
llvm/include/llvm/Support/Casting.h:578: decltype(auto) llvm::cast(From*) [with To = clang::TypeDecl; From = clang::Decl]: Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
```

Allows for more flexible calls from cppyy, being less crash-prone. The old test has been extended.
@aaronj0 aaronj0 force-pushed the gettype-failure-path branch from 0553d80 to af012a2 Compare March 1, 2026 10:36
@aaronj0 aaronj0 merged commit 3b67f16 into compiler-research:main Mar 1, 2026
58 of 59 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants