mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 03:51:18 +00:00
Update to constdef
This commit is contained in:
committed by
Christoffer Lerno
parent
0387d7666d
commit
5a82f672b5
@@ -1,7 +1,7 @@
|
||||
import std;
|
||||
fn int foo() => 0;
|
||||
alias FooFn = fn int();
|
||||
const enum Bar : FooFn
|
||||
constdef Bar : FooFn
|
||||
{
|
||||
FOO = fn () => (int)(iptr)ExclusiveRange{int}.typeid,
|
||||
BAR = &foo,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import std::io;
|
||||
|
||||
const enum MyEnum : inline CInt
|
||||
constdef MyEnum : inline CInt
|
||||
{
|
||||
FOO = 1,
|
||||
BAR = 5,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// #target: macos-x64
|
||||
module test;
|
||||
const enum Foo : inline String
|
||||
constdef Foo : inline String
|
||||
{
|
||||
HELO = "Helo"
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ struct Bar
|
||||
uint x, y, z;
|
||||
}
|
||||
|
||||
const enum Foo : inline Bar
|
||||
constdef Foo : inline Bar
|
||||
{
|
||||
X = {1, 0, 0},
|
||||
Y = {0, 1, 0},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// #target: macos-x64
|
||||
module test;
|
||||
|
||||
const enum Enum : int
|
||||
constdef Enum : int
|
||||
{
|
||||
E0, E1
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const enum MyEnum
|
||||
constdef MyEnum
|
||||
{
|
||||
VAL1 = VAL3, // #error: Unable to properly resolve enum constant value, this can sometimes happen in recursive definitions
|
||||
VAL1 = VAL3, // #error: Unable to properly resolve constdef value, this can sometimes happen in recursive definitions
|
||||
VAL2 ,
|
||||
VAL3
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
module test;
|
||||
import std;
|
||||
|
||||
const enum Color : char[<4>]
|
||||
constdef Color : char[<4>]
|
||||
{
|
||||
LIGHTGRAY = { 200, 200, 200, 255 },
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ enum Foo : (FooFn f)
|
||||
BAR { &foo }, // allowed
|
||||
}
|
||||
|
||||
const enum Bar : FooFn
|
||||
constdef Bar : FooFn
|
||||
{
|
||||
FOO = fn int() => 0, // allowed
|
||||
BAR = &foo, // Error: Expected an constant enum value.
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
module test;
|
||||
import std;
|
||||
|
||||
const enum Bar : String
|
||||
constdef Bar : String
|
||||
{
|
||||
XABC = "foekf",
|
||||
XDEF = "foekfokef"
|
||||
}
|
||||
|
||||
const enum Foo : int
|
||||
constdef Foo : int
|
||||
{
|
||||
ABC = 4,
|
||||
DEF,
|
||||
@@ -18,7 +18,7 @@ const enum Foo : int
|
||||
}
|
||||
|
||||
|
||||
const enum Bde2 : int
|
||||
constdef Bde2 : int
|
||||
{
|
||||
FOO = 2,
|
||||
BAR = 100
|
||||
@@ -30,7 +30,7 @@ const BDE3_BAR = 100;
|
||||
|
||||
|
||||
|
||||
const enum Abc2 : int
|
||||
constdef Abc2 : int
|
||||
{
|
||||
UP,
|
||||
DOWN,
|
||||
|
||||
@@ -12,7 +12,7 @@ fn void Foo.x(&self) @dynamic
|
||||
io::printn("Foo!");
|
||||
}
|
||||
|
||||
const enum Tester : inline Foo
|
||||
constdef Tester : inline Foo
|
||||
{
|
||||
ABC = 1
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ struct Foo
|
||||
|
||||
module bar;
|
||||
|
||||
const enum MyEnum : CInt
|
||||
constdef MyEnum : CInt
|
||||
{
|
||||
VAL1 = 1,
|
||||
VAL2 = 2,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
module test;
|
||||
const enum MyEnum : inline short
|
||||
constdef MyEnum : inline short
|
||||
{
|
||||
ITEM1,
|
||||
ITEM2,
|
||||
|
||||
@@ -2,7 +2,7 @@ module main;
|
||||
|
||||
faultdef F;
|
||||
|
||||
const enum Foo : fault
|
||||
constdef Foo : fault
|
||||
{
|
||||
F = F // #error: Recursive resolution of expression
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ enum Foo : inline int
|
||||
{
|
||||
ABC,
|
||||
}
|
||||
const enum Bar : inline int
|
||||
constdef Bar : inline int
|
||||
{
|
||||
HELLO = 1
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ enum Foobar : inline char
|
||||
BAZ
|
||||
}
|
||||
|
||||
const enum Foobar2 : inline int
|
||||
constdef Foobar2 : inline int
|
||||
{
|
||||
ABC = 3,
|
||||
DEF = 5,
|
||||
|
||||
@@ -63,7 +63,7 @@ enum Foobar : inline char
|
||||
BAZ
|
||||
}
|
||||
|
||||
const enum Foobar2 : inline int
|
||||
constdef Foobar2 : inline int
|
||||
{
|
||||
ABC = 3,
|
||||
DEF = 5,
|
||||
|
||||
Reference in New Issue
Block a user