Foo.is_eq would return false if the type was a typedef and had an overload, but the underlying type was not comparable. Version 0.7.8.

This commit is contained in:
Christoffer Lerno
2025-10-31 22:47:01 +01:00
parent 5a3c484ceb
commit f25ad512a7
4 changed files with 23 additions and 3 deletions

View File

@@ -1,5 +1,13 @@
# C3C Release Notes
## 0.7.8 Change list
### Changes / improvements
### Fixes
- `Foo.is_eq` would return false if the type was a `typedef` and had an overload, but the underlying type was not comparable.
### Stdlib changes
## 0.7.7 Change list
### Changes / improvements

View File

@@ -5760,7 +5760,7 @@ static bool sema_expr_rewrite_to_type_property(SemaContext *context, Expr *expr,
expr_rewrite_const_bool(expr, type_bool, type_is_ordered(flat));
return true;
case TYPE_PROPERTY_IS_EQ:
switch (sema_type_can_check_equality_with_overload(context, flat))
switch (sema_type_can_check_equality_with_overload(context, type))
{
case BOOL_ERR:
return false;

View File

@@ -1,2 +1,2 @@
#define COMPILER_VERSION "0.7.7"
#define PRERELEASE 0
#define COMPILER_VERSION "0.7.8"
#define PRERELEASE 1

View File

@@ -0,0 +1,12 @@
module test;
import std;
struct Boo { int a; }
typedef Foo = Boo;
fn bool Foo.eq(Foo a, Foo b) @operator(==) => false;
fn int main()
{
$assert Foo.is_eq;
return 0;
}