autofix-type-conversion
Fixes type mismatch errors by adding appropriate casts or conversions.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Fixes type mismatch errors by adding appropriate casts or conversions.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
Comprehensive build error repair tool for C++, Rust, and Java projects using Soong, GN, Make, or CMake. Automatically fixes 30+ types of errors including headers, linking, APIs, and config.
Fixes function call errors with wrong number or type of arguments.
Fixes syntax errors in Android.bp files.
Removes unsupported or unknown compiler flags from build configurations.
Fixes scope and variable errors in BUILD.gn files.
Fixes script permission errors by making files executable.
| name | autofix-type-conversion |
| description | Fixes type mismatch errors by adding appropriate casts or conversions. |
Fixes compilation errors related to incompatible type assignments or conversions.
cannot convert 'X' to 'Y'invalid conversion from 'X' to 'Y'no viable conversionincompatible typesExtract:
| From | To | Fix |
|---|---|---|
std::string | const char* | .c_str() |
const char* | std::string | Constructor or assignment |
int | enum | static_cast<EnumType>(val) |
void* | T* | static_cast<T*>(ptr) |
Base* | Derived* | dynamic_cast<Derived*>(base) |
int64_t | int | static_cast<int>(val) (with care) |
Example: string to const char*
// Before (error)
void log(const char* msg);
std::string message = "Hello";
log(message); // ERROR
// After
log(message.c_str());
Example: enum cast
// Before
int value = 5;
MyEnum e = value; // ERROR
// After
MyEnum e = static_cast<MyEnum>(value);
Ensure semantic correctness, not just compilation success.