mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-08 21:17:45 +00:00
Update internals to initializer instead of constructor.
This CL catches up the internals (along with a few error messages) to say `initializer` instead of `constructor. Bug: tint:1600 Change-Id: I8e56572c310d77da1130380bdd32b334f27c8e46 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106462 Reviewed-by: Antonio Maiorano <amaiorano@google.com> Auto-Submit: Dan Sinclair <dsinclair@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
56ce1a2155
commit
6e77b47ed9
@@ -59,18 +59,18 @@ func TestFixSubstr(t *testing.T) {
|
||||
}, { ///////////////////////////////////////////////////////////////////
|
||||
body: `Return{
|
||||
{
|
||||
ScalarConstructor[not set]{42u}
|
||||
ScalarInitializer[not set]{42u}
|
||||
}
|
||||
}
|
||||
`,
|
||||
substr: `Return{
|
||||
{
|
||||
ScalarConstructor[not set]{42}
|
||||
ScalarInitializer[not set]{42}
|
||||
}
|
||||
}`,
|
||||
expect: `Return{
|
||||
{
|
||||
ScalarConstructor[not set]{42u}
|
||||
ScalarInitializer[not set]{42u}
|
||||
}
|
||||
}`,
|
||||
}, { ///////////////////////////////////////////////////////////////////
|
||||
@@ -83,29 +83,29 @@ func TestFixSubstr(t *testing.T) {
|
||||
}
|
||||
Assignment{
|
||||
Identifier[not set]{x_1}
|
||||
ScalarConstructor[not set]{42u}
|
||||
ScalarInitializer[not set]{42u}
|
||||
}
|
||||
Assignment{
|
||||
Identifier[not set]{x_1}
|
||||
ScalarConstructor[not set]{0u}
|
||||
ScalarInitializer[not set]{0u}
|
||||
}
|
||||
Return{}
|
||||
`,
|
||||
substr: `Assignment{
|
||||
Identifier[not set]{x_1}
|
||||
ScalarConstructor[not set]{42}
|
||||
ScalarInitializer[not set]{42}
|
||||
}
|
||||
Assignment{
|
||||
Identifier[not set]{x_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
ScalarInitializer[not set]{0}
|
||||
}`,
|
||||
expect: `Assignment{
|
||||
Identifier[not set]{x_1}
|
||||
ScalarConstructor[not set]{42u}
|
||||
ScalarInitializer[not set]{42u}
|
||||
}
|
||||
Assignment{
|
||||
Identifier[not set]{x_1}
|
||||
ScalarConstructor[not set]{0u}
|
||||
ScalarInitializer[not set]{0u}
|
||||
}`,
|
||||
}, { ///////////////////////////////////////////////////////////////////
|
||||
body: `VariableDeclStatement{
|
||||
@@ -114,7 +114,7 @@ Assignment{
|
||||
function
|
||||
__bool
|
||||
{
|
||||
ScalarConstructor[not set]{true}
|
||||
ScalarInitializer[not set]{true}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -124,7 +124,7 @@ VariableDeclStatement{
|
||||
function
|
||||
__bool
|
||||
{
|
||||
ScalarConstructor[not set]{false}
|
||||
ScalarInitializer[not set]{false}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -134,7 +134,7 @@ VariableDeclStatement{
|
||||
function
|
||||
__i32
|
||||
{
|
||||
ScalarConstructor[not set]{-1}
|
||||
ScalarInitializer[not set]{-1}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -144,7 +144,7 @@ VariableDeclStatement{
|
||||
function
|
||||
__u32
|
||||
{
|
||||
ScalarConstructor[not set]{1u}
|
||||
ScalarInitializer[not set]{1u}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -154,7 +154,7 @@ VariableDeclStatement{
|
||||
function
|
||||
__f32
|
||||
{
|
||||
ScalarConstructor[not set]{1.500000}
|
||||
ScalarInitializer[not set]{1.500000}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -165,7 +165,7 @@ VariableDeclStatement{
|
||||
function
|
||||
__bool
|
||||
{
|
||||
ScalarConstructor[not set]{true}
|
||||
ScalarInitializer[not set]{true}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -175,7 +175,7 @@ VariableDeclStatement{
|
||||
function
|
||||
__bool
|
||||
{
|
||||
ScalarConstructor[not set]{false}
|
||||
ScalarInitializer[not set]{false}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -185,7 +185,7 @@ VariableDeclStatement{
|
||||
function
|
||||
__i32
|
||||
{
|
||||
ScalarConstructor[not set]{-1}
|
||||
ScalarInitializer[not set]{-1}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -195,7 +195,7 @@ VariableDeclStatement{
|
||||
function
|
||||
__u32
|
||||
{
|
||||
ScalarConstructor[not set]{1}
|
||||
ScalarInitializer[not set]{1}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -205,7 +205,7 @@ VariableDeclStatement{
|
||||
function
|
||||
__f32
|
||||
{
|
||||
ScalarConstructor[not set]{1.500000}
|
||||
ScalarInitializer[not set]{1.500000}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -216,7 +216,7 @@ VariableDeclStatement{
|
||||
function
|
||||
__bool
|
||||
{
|
||||
ScalarConstructor[not set]{true}
|
||||
ScalarInitializer[not set]{true}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -226,7 +226,7 @@ VariableDeclStatement{
|
||||
function
|
||||
__bool
|
||||
{
|
||||
ScalarConstructor[not set]{false}
|
||||
ScalarInitializer[not set]{false}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -236,7 +236,7 @@ VariableDeclStatement{
|
||||
function
|
||||
__i32
|
||||
{
|
||||
ScalarConstructor[not set]{-1}
|
||||
ScalarInitializer[not set]{-1}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -246,7 +246,7 @@ VariableDeclStatement{
|
||||
function
|
||||
__u32
|
||||
{
|
||||
ScalarConstructor[not set]{1u}
|
||||
ScalarInitializer[not set]{1u}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -256,7 +256,7 @@ VariableDeclStatement{
|
||||
function
|
||||
__f32
|
||||
{
|
||||
ScalarConstructor[not set]{1.500000}
|
||||
ScalarInitializer[not set]{1.500000}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ type AST struct {
|
||||
Types []TypeDecl
|
||||
Matchers []MatcherDecl
|
||||
Builtins []IntrinsicDecl
|
||||
Constructors []IntrinsicDecl
|
||||
Initializers []IntrinsicDecl
|
||||
Converters []IntrinsicDecl
|
||||
Operators []IntrinsicDecl
|
||||
}
|
||||
@@ -52,7 +52,7 @@ func (a AST) String() string {
|
||||
fmt.Fprintf(&sb, "%v", b)
|
||||
fmt.Fprintln(&sb)
|
||||
}
|
||||
for _, o := range a.Constructors {
|
||||
for _, o := range a.Initializers {
|
||||
fmt.Fprintf(&sb, "%v", o)
|
||||
fmt.Fprintln(&sb)
|
||||
}
|
||||
@@ -113,7 +113,7 @@ func (m MatcherDecl) Format(w fmt.State, verb rune) {
|
||||
m.Options.Format(w, verb)
|
||||
}
|
||||
|
||||
// IntrinsicKind is either a Builtin, Operator, Constructor or Converter
|
||||
// IntrinsicKind is either a Builtin, Operator, Initializer or Converter
|
||||
type IntrinsicKind string
|
||||
|
||||
const (
|
||||
@@ -123,9 +123,9 @@ const (
|
||||
// Operator is a unary or binary operator.
|
||||
// Declared with 'op'.
|
||||
Operator IntrinsicKind = "operator"
|
||||
// Constructor is a type constructor function.
|
||||
// Declared with 'ctor'.
|
||||
Constructor IntrinsicKind = "constructor"
|
||||
// Initializer is a type initializer function.
|
||||
// Declared with 'init'.
|
||||
Initializer IntrinsicKind = "initializer"
|
||||
// Converter is a type conversion function.
|
||||
// Declared with 'conv'.
|
||||
Converter IntrinsicKind = "converter"
|
||||
@@ -149,8 +149,8 @@ func (i IntrinsicDecl) Format(w fmt.State, verb rune) {
|
||||
fmt.Fprintf(w, "fn ")
|
||||
case Operator:
|
||||
fmt.Fprintf(w, "op ")
|
||||
case Constructor:
|
||||
fmt.Fprintf(w, "ctor ")
|
||||
case Initializer:
|
||||
fmt.Fprintf(w, "init ")
|
||||
case Converter:
|
||||
fmt.Fprintf(w, "conv ")
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ type IntrinsicTable struct {
|
||||
Builtins []Intrinsic // kBuiltins table content
|
||||
UnaryOperators []Intrinsic // kUnaryOperators table content
|
||||
BinaryOperators []Intrinsic // kBinaryOperators table content
|
||||
ConstructorsAndConverters []Intrinsic // kConstructorsAndConverters table content
|
||||
InitializersAndConverters []Intrinsic // kInitializersAndConverters table content
|
||||
}
|
||||
|
||||
// TemplateType is used to create the C++ TemplateTypeInfo structure
|
||||
@@ -381,7 +381,7 @@ func BuildIntrinsicTable(s *sem.Sem) (*IntrinsicTable, error) {
|
||||
{s.Builtins, &b.Builtins},
|
||||
{s.UnaryOperators, &b.UnaryOperators},
|
||||
{s.BinaryOperators, &b.BinaryOperators},
|
||||
{s.ConstructorsAndConverters, &b.ConstructorsAndConverters},
|
||||
{s.InitializersAndConverters, &b.InitializersAndConverters},
|
||||
} {
|
||||
out := make([]Intrinsic, len(intrinsics.in))
|
||||
for i, f := range intrinsics.in {
|
||||
|
||||
@@ -98,7 +98,7 @@ func (l *lexer) lex() error {
|
||||
case l.match("op", tok.Operator):
|
||||
case l.match("enum", tok.Enum):
|
||||
case l.match("type", tok.Type):
|
||||
case l.match("ctor", tok.Constructor):
|
||||
case l.match("init", tok.Initializer):
|
||||
case l.match("conv", tok.Converter):
|
||||
case l.match("match", tok.Match):
|
||||
case unicode.IsLetter(l.peek(0)) || l.peek(0) == '_':
|
||||
|
||||
@@ -58,7 +58,7 @@ func TestLexTokens(t *testing.T) {
|
||||
{"type", tok.Token{Kind: tok.Type, Runes: []rune("type"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 5, 4),
|
||||
}}},
|
||||
{"ctor", tok.Token{Kind: tok.Constructor, Runes: []rune("ctor"), Source: tok.Source{
|
||||
{"init", tok.Token{Kind: tok.Initializer, Runes: []rune("init"), Source: tok.Source{
|
||||
S: loc(1, 1, 0), E: loc(1, 5, 4),
|
||||
}}},
|
||||
{"conv", tok.Token{Kind: tok.Converter, Runes: []rune("conv"), Source: tok.Source{
|
||||
|
||||
@@ -71,8 +71,8 @@ func (p *parser) parse() (*ast.AST, error) {
|
||||
case tok.Operator:
|
||||
out.Operators = append(out.Operators, p.operatorDecl(attributes))
|
||||
attributes = nil
|
||||
case tok.Constructor:
|
||||
out.Constructors = append(out.Constructors, p.constructorDecl(attributes))
|
||||
case tok.Initializer:
|
||||
out.Initializers = append(out.Initializers, p.initializerDecl(attributes))
|
||||
attributes = nil
|
||||
case tok.Converter:
|
||||
out.Converters = append(out.Converters, p.converterDecl(attributes))
|
||||
@@ -204,12 +204,12 @@ func (p *parser) operatorDecl(decos ast.Attributes) ast.IntrinsicDecl {
|
||||
return f
|
||||
}
|
||||
|
||||
func (p *parser) constructorDecl(decos ast.Attributes) ast.IntrinsicDecl {
|
||||
p.expect(tok.Constructor, "constructor declaration")
|
||||
func (p *parser) initializerDecl(decos ast.Attributes) ast.IntrinsicDecl {
|
||||
p.expect(tok.Initializer, "initializer declaration")
|
||||
name := p.next()
|
||||
f := ast.IntrinsicDecl{
|
||||
Source: name.Source,
|
||||
Kind: ast.Constructor,
|
||||
Kind: ast.Initializer,
|
||||
Attributes: decos,
|
||||
Name: string(name.Runes),
|
||||
}
|
||||
|
||||
@@ -440,20 +440,20 @@ func TestParser(t *testing.T) {
|
||||
},
|
||||
}, { ///////////////////////////////////////////////////////////////////
|
||||
utils.ThisLine(),
|
||||
"ctor F()",
|
||||
"init F()",
|
||||
ast.AST{
|
||||
Constructors: []ast.IntrinsicDecl{{
|
||||
Kind: ast.Constructor,
|
||||
Initializers: []ast.IntrinsicDecl{{
|
||||
Kind: ast.Initializer,
|
||||
Name: "F",
|
||||
Parameters: ast.Parameters{},
|
||||
}},
|
||||
},
|
||||
}, { ///////////////////////////////////////////////////////////////////
|
||||
utils.ThisLine(),
|
||||
"@attr ctor F()",
|
||||
"@attr init F()",
|
||||
ast.AST{
|
||||
Constructors: []ast.IntrinsicDecl{{
|
||||
Kind: ast.Constructor,
|
||||
Initializers: []ast.IntrinsicDecl{{
|
||||
Kind: ast.Initializer,
|
||||
Name: "F",
|
||||
Attributes: ast.Attributes{
|
||||
{Name: "attr", Values: []string{}},
|
||||
@@ -463,10 +463,10 @@ func TestParser(t *testing.T) {
|
||||
},
|
||||
}, { ///////////////////////////////////////////////////////////////////
|
||||
utils.ThisLine(),
|
||||
"ctor F(a)",
|
||||
"init F(a)",
|
||||
ast.AST{
|
||||
Constructors: []ast.IntrinsicDecl{{
|
||||
Kind: ast.Constructor,
|
||||
Initializers: []ast.IntrinsicDecl{{
|
||||
Kind: ast.Initializer,
|
||||
Name: "F",
|
||||
Parameters: ast.Parameters{
|
||||
{Type: ast.TemplatedName{Name: "a"}},
|
||||
@@ -475,10 +475,10 @@ func TestParser(t *testing.T) {
|
||||
},
|
||||
}, { ///////////////////////////////////////////////////////////////////
|
||||
utils.ThisLine(),
|
||||
"ctor F(a: T)",
|
||||
"init F(a: T)",
|
||||
ast.AST{
|
||||
Constructors: []ast.IntrinsicDecl{{
|
||||
Kind: ast.Constructor,
|
||||
Initializers: []ast.IntrinsicDecl{{
|
||||
Kind: ast.Initializer,
|
||||
Name: "F",
|
||||
Parameters: ast.Parameters{
|
||||
{Name: "a", Type: ast.TemplatedName{Name: "T"}},
|
||||
@@ -487,10 +487,10 @@ func TestParser(t *testing.T) {
|
||||
},
|
||||
}, { ///////////////////////////////////////////////////////////////////
|
||||
utils.ThisLine(),
|
||||
"ctor F(a, b)",
|
||||
"init F(a, b)",
|
||||
ast.AST{
|
||||
Constructors: []ast.IntrinsicDecl{{
|
||||
Kind: ast.Constructor,
|
||||
Initializers: []ast.IntrinsicDecl{{
|
||||
Kind: ast.Initializer,
|
||||
Name: "F",
|
||||
Parameters: ast.Parameters{
|
||||
{Type: ast.TemplatedName{Name: "a"}},
|
||||
@@ -500,10 +500,10 @@ func TestParser(t *testing.T) {
|
||||
},
|
||||
}, { ///////////////////////////////////////////////////////////////////
|
||||
utils.ThisLine(),
|
||||
"ctor F<A : B<C> >()",
|
||||
"init F<A : B<C> >()",
|
||||
ast.AST{
|
||||
Constructors: []ast.IntrinsicDecl{{
|
||||
Kind: ast.Constructor,
|
||||
Initializers: []ast.IntrinsicDecl{{
|
||||
Kind: ast.Initializer,
|
||||
Name: "F",
|
||||
TemplateParams: ast.TemplateParams{
|
||||
{
|
||||
@@ -520,10 +520,10 @@ func TestParser(t *testing.T) {
|
||||
},
|
||||
}, { ///////////////////////////////////////////////////////////////////
|
||||
utils.ThisLine(),
|
||||
"ctor F<T>(a: X, b: Y<T>)",
|
||||
"init F<T>(a: X, b: Y<T>)",
|
||||
ast.AST{
|
||||
Constructors: []ast.IntrinsicDecl{{
|
||||
Kind: ast.Constructor,
|
||||
Initializers: []ast.IntrinsicDecl{{
|
||||
Kind: ast.Initializer,
|
||||
Name: "F",
|
||||
TemplateParams: ast.TemplateParams{
|
||||
{Name: "T"},
|
||||
@@ -539,10 +539,10 @@ func TestParser(t *testing.T) {
|
||||
},
|
||||
}, { ///////////////////////////////////////////////////////////////////
|
||||
utils.ThisLine(),
|
||||
"ctor F() -> X",
|
||||
"init F() -> X",
|
||||
ast.AST{
|
||||
Constructors: []ast.IntrinsicDecl{{
|
||||
Kind: ast.Constructor,
|
||||
Initializers: []ast.IntrinsicDecl{{
|
||||
Kind: ast.Initializer,
|
||||
Name: "F",
|
||||
ReturnType: &ast.TemplatedName{Name: "X"},
|
||||
Parameters: ast.Parameters{},
|
||||
@@ -550,10 +550,10 @@ func TestParser(t *testing.T) {
|
||||
},
|
||||
}, { ///////////////////////////////////////////////////////////////////
|
||||
utils.ThisLine(),
|
||||
"ctor F() -> X<T>",
|
||||
"init F() -> X<T>",
|
||||
ast.AST{
|
||||
Constructors: []ast.IntrinsicDecl{{
|
||||
Kind: ast.Constructor,
|
||||
Initializers: []ast.IntrinsicDecl{{
|
||||
Kind: ast.Initializer,
|
||||
Name: "F",
|
||||
ReturnType: &ast.TemplatedName{
|
||||
Name: "X",
|
||||
|
||||
@@ -33,7 +33,7 @@ type resolver struct {
|
||||
builtins map[string]*sem.Intrinsic
|
||||
unaryOperators map[string]*sem.Intrinsic
|
||||
binaryOperators map[string]*sem.Intrinsic
|
||||
constructorsAndConverters map[string]*sem.Intrinsic
|
||||
initializersAndConverters map[string]*sem.Intrinsic
|
||||
enumEntryMatchers map[*sem.EnumEntry]*sem.EnumMatcher
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ func Resolve(a *ast.AST) (*sem.Sem, error) {
|
||||
builtins: map[string]*sem.Intrinsic{},
|
||||
unaryOperators: map[string]*sem.Intrinsic{},
|
||||
binaryOperators: map[string]*sem.Intrinsic{},
|
||||
constructorsAndConverters: map[string]*sem.Intrinsic{},
|
||||
initializersAndConverters: map[string]*sem.Intrinsic{},
|
||||
enumEntryMatchers: map[*sem.EnumEntry]*sem.EnumMatcher{},
|
||||
}
|
||||
// Declare and resolve all the enumerators
|
||||
@@ -89,9 +89,9 @@ func Resolve(a *ast.AST) (*sem.Sem, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// Declare and resolve type constructors and converters
|
||||
for _, c := range a.Constructors {
|
||||
if err := r.intrinsic(c, r.constructorsAndConverters, &r.s.ConstructorsAndConverters); err != nil {
|
||||
// Declare and resolve type initializers and converters
|
||||
for _, c := range a.Initializers {
|
||||
if err := r.intrinsic(c, r.initializersAndConverters, &r.s.InitializersAndConverters); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
@@ -99,7 +99,7 @@ func Resolve(a *ast.AST) (*sem.Sem, error) {
|
||||
if len(c.Parameters) != 1 {
|
||||
return nil, fmt.Errorf("%v conversions must have a single parameter", c.Source)
|
||||
}
|
||||
if err := r.intrinsic(c, r.constructorsAndConverters, &r.s.ConstructorsAndConverters); err != nil {
|
||||
if err := r.intrinsic(c, r.initializersAndConverters, &r.s.InitializersAndConverters); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
@@ -352,8 +352,8 @@ func (r *resolver) intrinsic(
|
||||
switch overload.Decl.Kind {
|
||||
case ast.Builtin, ast.Operator:
|
||||
overload.ConstEvalFunction = overload.Decl.Name
|
||||
case ast.Constructor:
|
||||
overload.ConstEvalFunction = "Ctor"
|
||||
case ast.Initializer:
|
||||
overload.ConstEvalFunction = "init"
|
||||
case ast.Converter:
|
||||
overload.ConstEvalFunction = "Conv"
|
||||
}
|
||||
@@ -574,7 +574,7 @@ func (r *resolver) calculateUniqueParameterNames() []string {
|
||||
r.s.Builtins,
|
||||
r.s.UnaryOperators,
|
||||
r.s.BinaryOperators,
|
||||
r.s.ConstructorsAndConverters,
|
||||
r.s.InitializersAndConverters,
|
||||
} {
|
||||
for _, i := range intrinsics {
|
||||
for _, o := range i.Overloads {
|
||||
|
||||
@@ -164,13 +164,13 @@ op +(T<f32>, T<f32>)`,
|
||||
}, {
|
||||
`
|
||||
type f32
|
||||
ctor f32(f32)`,
|
||||
init f32(f32)`,
|
||||
success,
|
||||
}, {
|
||||
`
|
||||
type f32
|
||||
type T<x>
|
||||
ctor f32(T<f32>)`,
|
||||
init f32(T<f32>)`,
|
||||
success,
|
||||
}, {
|
||||
`
|
||||
@@ -394,57 +394,57 @@ op << <M: m>(P<M>)`,
|
||||
`
|
||||
type i
|
||||
enum e { a }
|
||||
ctor F(i) -> e`,
|
||||
init F(i) -> e`,
|
||||
`file.txt:3:14 cannot use 'e' as return type. Must be a type or template type`,
|
||||
}, {
|
||||
`
|
||||
type T<x>
|
||||
ctor F(T<u>)`,
|
||||
init F(T<u>)`,
|
||||
`file.txt:2:10 cannot resolve 'u'`,
|
||||
}, {
|
||||
`
|
||||
type x
|
||||
ctor F<T>(T<x>)`,
|
||||
init F<T>(T<x>)`,
|
||||
`file.txt:2:11 'T' template parameters do not accept template arguments`,
|
||||
}, {
|
||||
`
|
||||
type A<N: num>
|
||||
type B
|
||||
ctor F(A<B>)`,
|
||||
init F(A<B>)`,
|
||||
`file.txt:3:10 cannot use type 'B' as template number`,
|
||||
}, {
|
||||
`
|
||||
type A<N>
|
||||
enum E { b }
|
||||
match M: E.b
|
||||
ctor F(A<M>)`,
|
||||
init F(A<M>)`,
|
||||
`file.txt:4:10 cannot use enum matcher 'M' as template type`,
|
||||
}, {
|
||||
`
|
||||
type T
|
||||
type P<N: num>
|
||||
match m: T
|
||||
ctor F(P<m>)`,
|
||||
init F(P<m>)`,
|
||||
`file.txt:4:10 cannot use type matcher 'm' as template number`,
|
||||
}, {
|
||||
`
|
||||
type P<N: num>
|
||||
enum E { b }
|
||||
ctor F(P<E>)`,
|
||||
init F(P<E>)`,
|
||||
`file.txt:3:10 cannot use enum 'E' as template number`,
|
||||
}, {
|
||||
`
|
||||
type P<N: num>
|
||||
enum E { a b }
|
||||
match m: E.a | E.b
|
||||
ctor F(P<m>)`,
|
||||
init F(P<m>)`,
|
||||
`file.txt:4:10 cannot use enum matcher 'm' as template number`,
|
||||
}, {
|
||||
`
|
||||
type P<N: num>
|
||||
enum E { a b }
|
||||
match m: E.a | E.b
|
||||
ctor F<M: m>(P<M>)`,
|
||||
init F<M: m>(P<M>)`,
|
||||
`file.txt:4:16 cannot use template enum 'E' as template number`,
|
||||
}, {
|
||||
`
|
||||
|
||||
@@ -31,7 +31,7 @@ type Sem struct {
|
||||
Builtins []*Intrinsic
|
||||
UnaryOperators []*Intrinsic
|
||||
BinaryOperators []*Intrinsic
|
||||
ConstructorsAndConverters []*Intrinsic
|
||||
InitializersAndConverters []*Intrinsic
|
||||
// Maximum number of template types used across all builtins
|
||||
MaxTemplateTypes int
|
||||
// Maximum number of template numbers used across all builtins
|
||||
|
||||
@@ -30,7 +30,7 @@ const (
|
||||
Match Kind = "match"
|
||||
Function Kind = "fn"
|
||||
Operator Kind = "op"
|
||||
Constructor Kind = "ctor"
|
||||
Initializer Kind = "init"
|
||||
Converter Kind = "conv"
|
||||
Type Kind = "type"
|
||||
Enum Kind = "enum"
|
||||
|
||||
Reference in New Issue
Block a user