Conditional Local Functions are considered unused
See original GitHub issueusing System.Diagnostics;
public class C {
public void M() {
local();
[Conditional("DEBUG")]
static void local() {} // Warning: unused local function
}
}
This reproes when compiling for release mode.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Why can we have unused functions but we can't ...
The behaviour seems consistent between variables and functions – both are allowed in a package-level scope, even if unused.
Read more >Unused local variable in Python
A code with many unused local variables, unused imports, or unused line of codes is considered to be dead code. When there are...
Read more >Unused variables vs unused functions · Issue #26080
So the compiler's behaviour is actually somewhat consistent. Unused vars inside a function are not allowed, while unused functions inside a ...
Read more >Unused assignments should be removed
Unused assignments should be removed ... A dead store happens when a local variable is assigned a value that is not read by...
Read more >Today: how to identify unused exported functions and variables
The obvious way to check for this is to use the -Wunused flag during compile, GCC will inform you about unused parameters, local...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Absolutely not, we’re glad you’re here.
I think the fix to this bug is to ensure that the appropriate analysis pass adds the local function to the set of used local functions, regardless of the presence of any ConditionalAttribute, etc.