checker: more arr1=arr2 fixes
parent
628021a7cf
commit
583c02316a
|
@ -173,7 +173,7 @@ pub fn (mut b Builder) resolve_deps() {
|
|||
|
||||
// graph of all imported modules
|
||||
pub fn (b &Builder) import_graph() &depgraph.DepGraph {
|
||||
builtins := util.builtin_module_parts
|
||||
builtins := util.builtin_module_parts.clone()
|
||||
mut graph := depgraph.new_dep_graph()
|
||||
for p in b.parsed_files {
|
||||
mut deps := []string{}
|
||||
|
|
|
@ -2210,9 +2210,10 @@ pub fn (mut c Checker) assign_stmt(mut assign_stmt ast.AssignStmt) {
|
|||
continue
|
||||
}
|
||||
if left_sym.kind == .array &&
|
||||
assign_stmt.op == .assign && right_sym.kind == .array && left is ast.Ident && right is ast.Ident {
|
||||
assign_stmt.op in [.assign, .decl_assign] && right_sym.kind == .array && left is ast.Ident &&
|
||||
right is ast.Ident {
|
||||
// Do not allow `a = b`, only `a = b.clone()`
|
||||
c.warn('use `array2 = array1.clone()` instead of `array1 = array2`', assign_stmt.pos)
|
||||
c.warn('use `array2 = array1.clone()` instead of `array2 = array1`', assign_stmt.pos)
|
||||
}
|
||||
left_is_ptr := left_type.is_ptr() || left_sym.is_pointer()
|
||||
if left_is_ptr {
|
||||
|
|
Loading…
Reference in New Issue