Skip to content

Commit

Permalink
Merge pull request #2669 from laytan/check-disabled-when-generating-p…
Browse files Browse the repository at this point in the history
…arapoly

Fix #2666 by checking for disabled when generating parapoly procs
  • Loading branch information
gingerBill authored Aug 1, 2023
2 parents a4de59c + 7433873 commit 9453b23
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/check_expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions tests/issues/run.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions tests/issues/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 26 additions & 0 deletions tests/issues/test_issue_2666.odin
Original file line number Diff line number Diff line change
@@ -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")
}

0 comments on commit 9453b23

Please sign in to comment.