mirror of
https://github.com/odin-lang/Odin.git
synced 2026-08-14 09:44:26 +00:00
Merge pull request #7257 from michtesar/fix/type-specialization
Return false for identical specialization types
This commit is contained in:
@@ -7370,7 +7370,11 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
|
||||
|
||||
operand->mode = Addressing_Constant;
|
||||
operand->type = t_untyped_bool;
|
||||
operand->value = exact_value_bool(check_type_specialization_to(c, s, t, false, false));
|
||||
bool is_specialization = false;
|
||||
if (!are_types_identical(s, t)) {
|
||||
is_specialization = check_type_specialization_to(c, s, t, false, false);
|
||||
}
|
||||
operand->value = exact_value_bool(is_specialization);
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -41,6 +41,7 @@ set COMMON=-define:ODIN_TEST_FANCY=false -file -vet -strict-style -ignore-unused
|
||||
..\..\..\odin test ..\test_issue_6753.odin %COMMON% || exit /b
|
||||
..\..\..\odin check ..\test_issue_6874.odin %COMMON% 2>&1 | find /c "Error:" | findstr /x "1" || exit /b
|
||||
..\..\..\odin check ..\test_issue_6979.odin -no-entry-point %COMMON% || exit /b
|
||||
..\..\..\odin check ..\test_issue_7012.odin -no-entry-point %COMMON% || exit /b
|
||||
..\..\..\odin build ..\test_issue_7037.odin %COMMON% -o:none || exit /b
|
||||
..\..\..\odin build ..\test_issue_7188.odin %COMMON% || exit /b
|
||||
..\..\..\odin build ..\test_issue_7073-1.odin %COMMON% 2>&1 | find /c "Error:" | findstr /x "2" || exit /b
|
||||
|
||||
@@ -89,6 +89,7 @@ else
|
||||
exit 1
|
||||
fi
|
||||
$ODIN check ../test_issue_6979.odin -no-entry-point $COMMON_CHECK
|
||||
$ODIN check ../test_issue_7012.odin -no-entry-point $COMMON_CHECK
|
||||
$ODIN build ../test_issue_7037.odin $COMMON -o:none
|
||||
$ODIN build ../test_issue_7167.odin $COMMON
|
||||
$ODIN build ../test_issue_7188.odin $COMMON
|
||||
|
||||
13
tests/issues/test_issue_7012.odin
Normal file
13
tests/issues/test_issue_7012.odin
Normal file
@@ -0,0 +1,13 @@
|
||||
// Tests issue https://github.com/odin-lang/Odin/issues/7012
|
||||
package test_issues
|
||||
|
||||
import "base:intrinsics"
|
||||
|
||||
Foo :: struct($T: typeid) {
|
||||
x: T,
|
||||
}
|
||||
|
||||
#assert(intrinsics.type_is_specialization_of(Foo(int), Foo))
|
||||
#assert(!intrinsics.type_is_specialization_of(Foo, Foo))
|
||||
#assert(!intrinsics.type_is_specialization_of(Foo(int), Foo(int)))
|
||||
#assert(!intrinsics.type_is_specialization_of(i32, Foo))
|
||||
Reference in New Issue
Block a user