parser: fix string interpolation for default conversion
							parent
							
								
									de749e9d3b
								
							
						
					
					
						commit
						4a096bd133
					
				| 
						 | 
					@ -900,7 +900,7 @@ fn (mut p Parser) string_expr() ast.Expr {
 | 
				
			||||||
				efmt << p.tok.lit
 | 
									efmt << p.tok.lit
 | 
				
			||||||
				p.next()
 | 
									p.next()
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if p.tok.lit.len == 1 {
 | 
								if p.tok.kind == .name && p.tok.lit.len == 1 {
 | 
				
			||||||
				efmt << p.tok.lit
 | 
									efmt << p.tok.lit
 | 
				
			||||||
				p.next()
 | 
									p.next()
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -77,6 +77,8 @@ fn test_string_interpolation_string_prefix() {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fn test_inttypes_string_interpolation() {
 | 
					fn test_inttypes_string_interpolation() {
 | 
				
			||||||
 | 
						c := i8(-103)
 | 
				
			||||||
 | 
						uc := byte(217)
 | 
				
			||||||
	s := i16(-23456)
 | 
						s := i16(-23456)
 | 
				
			||||||
	us := u16(54321)
 | 
						us := u16(54321)
 | 
				
			||||||
	i := -1622999040
 | 
						i := -1622999040
 | 
				
			||||||
| 
						 | 
					@ -86,8 +88,9 @@ fn test_inttypes_string_interpolation() {
 | 
				
			||||||
	assert '$s $us' == '-23456 54321'
 | 
						assert '$s $us' == '-23456 54321'
 | 
				
			||||||
	assert '$ui $i' == '3421958087 -1622999040'
 | 
						assert '$ui $i' == '3421958087 -1622999040'
 | 
				
			||||||
	assert '$l $ul' == '-7694555558525237396 17234006112912956370'
 | 
						assert '$l $ul' == '-7694555558525237396 17234006112912956370'
 | 
				
			||||||
	assert '>${s:11}< >${us:-13}<-' == '>     -23456< >54321        <-'
 | 
						assert '>${s:11}:${us:-13}<' == '>     -23456:54321        <'
 | 
				
			||||||
	assert '0x${ul:-19x}< >${l:22d}<-' == '0xef2b7d4001165bd2   < >  -7694555558525237396<-'
 | 
						assert '0x${ul:-19x}:${l:22d}' == '0xef2b7d4001165bd2   :  -7694555558525237396'
 | 
				
			||||||
 | 
						assert '${c:5}${uc:-7}x' == ' -103217    x'
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fn test_utf8_string_interpolation() {
 | 
					fn test_utf8_string_interpolation() {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue