io: remove unused Zzz_CoerceInterfaceTableGeneration struct; add test for `x := Enum{}`

pull/8796/head
Delyan Angelov 2021-02-17 01:37:05 +02:00
parent 995e1c84a2
commit 2002d20249
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
3 changed files with 19 additions and 22 deletions

View File

@ -31,19 +31,3 @@ pub fn make_readerwriter(r Reader, w Writer) ReaderWriterImpl {
w: w w: w
} }
} }
struct Zzz_CoerceInterfaceTableGeneration {
}
fn (_ Zzz_CoerceInterfaceTableGeneration) write(buf []byte) ?int {
return none
}
fn (_ Zzz_CoerceInterfaceTableGeneration) read(mut buf []byte) ?int {
return none
}
fn zzz_reader_writer_coerce_compiler() {
x := Zzz_CoerceInterfaceTableGeneration{}
_ := make_readerwriter(x, x)
}

View File

@ -5037,11 +5037,9 @@ fn (mut g Gen) struct_init(struct_init ast.StructInit) {
g.indent-- g.indent--
} }
if g.pref.ccompiler == 'msvc' {
if !initialized { if !initialized {
g.write('\n#ifndef __cplusplus\n0\n#endif\n') g.write('\n#ifndef __cplusplus\n0\n#endif\n')
} }
}
g.write('}') g.write('}')
if g.is_shared && !g.inside_opt_data && !g.is_array_set { if g.is_shared && !g.inside_opt_data && !g.is_array_set {

View File

@ -118,3 +118,18 @@ fn test_typed_enum() {
} }
} }
*/ */
enum FileType {
unknown
wiki
file
image
html
}
fn test_enum_instance() {
mut filetype := FileType{}
eprintln(filetype)
s := 'x $filetype z'
assert s == 'x unknown z'
}