io: remove unused Zzz_CoerceInterfaceTableGeneration struct; add test for `x := Enum{}`
							parent
							
								
									995e1c84a2
								
							
						
					
					
						commit
						2002d20249
					
				|  | @ -4,7 +4,7 @@ module io | |||
| pub interface ReaderWriter { | ||||
| 	// from Reader
 | ||||
| 	read(mut buf []byte) ?int | ||||
| 		// from Writer
 | ||||
| 	// from Writer
 | ||||
| 	write(buf []byte) ?int | ||||
| } | ||||
| 
 | ||||
|  | @ -31,19 +31,3 @@ pub fn make_readerwriter(r Reader, w Writer) ReaderWriterImpl { | |||
| 		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) | ||||
| } | ||||
|  |  | |||
|  | @ -5037,10 +5037,8 @@ fn (mut g Gen) struct_init(struct_init ast.StructInit) { | |||
| 		g.indent-- | ||||
| 	} | ||||
| 
 | ||||
| 	if g.pref.ccompiler == 'msvc' { | ||||
| 		if !initialized { | ||||
| 			g.write('\n#ifndef __cplusplus\n0\n#endif\n') | ||||
| 		} | ||||
| 	if !initialized { | ||||
| 		g.write('\n#ifndef __cplusplus\n0\n#endif\n') | ||||
| 	} | ||||
| 
 | ||||
| 	g.write('}') | ||||
|  |  | |||
|  | @ -34,7 +34,7 @@ fn test_enum() { | |||
| 
 | ||||
| fn test_in() { | ||||
| 	color := Color.red | ||||
| 	num := 3	// used to be an expr bug before `in`
 | ||||
| 	num := 3 // used to be an expr bug before `in`
 | ||||
| 	assert color in [.red, .green] | ||||
| 	assert num == 3 | ||||
| 	println(color) | ||||
|  | @ -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' | ||||
| } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue