Merge pull request #2669 from laytan/check-disabled-when-generating-parapoly

Fix #2666 by checking for disabled when generating parapoly procs
This commit is contained in:
gingerBill
2023-08-01 14:45:36 +01:00
committed by GitHub
4 changed files with 32 additions and 0 deletions

View File

@@ -349,6 +349,10 @@ gb_internal bool find_or_generate_polymorphic_procedure(CheckerContext *old_c, E
return false;
}
if (base_entity->flags & EntityFlag_Disabled) {
return false;
}
String name = base_entity->token.string;
Type *src = base_type(base_entity->type);

View File

@@ -15,6 +15,7 @@ set COMMON=-collection:tests=..\..
..\..\..\odin test ..\test_issue_2466.odin %COMMON% -file || exit /b
..\..\..\odin test ..\test_issue_2615.odin %COMMON% -file || exit /b
..\..\..\odin test ..\test_issue_2637.odin %COMMON% -file || exit /b
..\..\..\odin test ..\test_issue_2666.odin %COMMON% -file || exit /b
@echo off

View File

@@ -18,6 +18,7 @@ $ODIN build ../test_issue_2113.odin $COMMON -file -debug
$ODIN test ../test_issue_2466.odin $COMMON -file
$ODIN test ../test_issue_2615.odin $COMMON -file
$ODIN test ../test_issue_2637.odin $COMMON -file
$ODIN test ../test_issue_2666.odin $COMMON -file
if [[ $($ODIN build ../test_issue_2395.odin $COMMON -file 2>&1 >/dev/null | grep -c "$NO_NIL_ERR") -eq 2 ]] ; then
echo "SUCCESSFUL 1/1"
else

View File

@@ -0,0 +1,26 @@
// Tests issue https://github.com/odin-lang/Odin/issues/2666
// @(disabled=<boolean>) does not work with polymorphic procs
package test_issues
import "core:testing"
@(test)
test_disabled_parapoly :: proc(t: ^testing.T) {
disabled_parapoly(t, 1)
disabled_parapoly_constant(t, 1)
}
@(private="file")
@(disabled = true)
disabled_parapoly :: proc(t: ^testing.T, num: $T) {
testing.error(t, "disabled_parapoly should be disabled")
}
@(private="file")
DISABLE :: true
@(disabled = DISABLE)
@(private = "file")
disabled_parapoly_constant :: proc(t: ^testing.T, num: $T) {
testing.error(t, "disabled_parapoly_constant should be disabled")
}