-- Ada
type My_Integer is new Integer;
type My_Integer is new Long_Integer;
type My_Integer is new Integer_32;
type My_Integer is new Integer range 10..9_999;
type My_Integer is range 10..9_999;
Foo: My_Integer;
Bar: Not_My_Integer;
Qux: Integer;
Foo := Foo + 1; -- OK
Foo := Foo + Bar; -- Not OK!
Foo := Foo + Qux; -- Not OK!
Foo := Foo + Foo(Qux); -- OK
// Rust
struct MyInteger(i32);
// below are hypothetical!
struct MyInteger(impl Int);
struct MyInteger(i32<10..10_000>);
struct MyInteger(impl Int<10..10_000>);
let foo: MyInteger;
let bar: NotMyInteger;
let qux: i32;
foo += 1; // OK?
foo += bar; // Not OK
foo += qux; // OK?
foo += qux.into(); // OK
// Rust + procedural macros
struct MyInteger(i32);
#[range(10..10_000)]
struct MyInteger(i32);
#[range(10..10_000)]
struct MyInteger(impl Int);
#[range(1..10, 91..100)]
struct MyInteger(i32);
my_int += 1; // OK
my_int += not_a_my_int; // Not OK
my_int += some_i32; // OK???
my_int += some_i32.into(); // OK