checker: more clear string error
							parent
							
								
									8580a0bcd7
								
							
						
					
					
						commit
						88cde776e7
					
				| 
						 | 
				
			
			@ -3091,7 +3091,9 @@ pub fn (mut c Checker) index_expr(mut node ast.IndexExpr) table.Type {
 | 
			
		|||
		c.error('type `$typ_sym.name` does not support indexing', node.pos)
 | 
			
		||||
	}
 | 
			
		||||
	if typ_sym.kind == .string && !typ.is_ptr() && node.is_setter {
 | 
			
		||||
		c.error('cannot assign to s[i] (strings are immutable)', node.pos)
 | 
			
		||||
		c.error('cannot assign to s[i] since V strings are immutable\n' +
 | 
			
		||||
			'(note, that variables may be mutable but string values are always immutable, like in Go and Java)',
 | 
			
		||||
			node.pos)
 | 
			
		||||
	}
 | 
			
		||||
	if !c.inside_unsafe && (typ.is_ptr() || typ.is_pointer()) {
 | 
			
		||||
		mut is_ok := false
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,9 +7,6 @@ import v.ast
 | 
			
		|||
import v.table
 | 
			
		||||
import v.util
 | 
			
		||||
 | 
			
		||||
pub fn kek_cheburek() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fn (mut g Gen) gen_fn_decl(it ast.FnDecl, skip bool) {
 | 
			
		||||
	// TODO For some reason, build fails with autofree with this line
 | 
			
		||||
	// as it's only informative, comment it for now
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue