From f657d70a6773c6bbae10b27b5afbe3599f4c6bd3 Mon Sep 17 00:00:00 2001 From: joe-conigliaro Date: Fri, 20 Sep 2019 19:23:43 +1000 Subject: [PATCH] typo detection: only check fn variables in same or higher scope --- compiler/fn.v | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compiler/fn.v b/compiler/fn.v index 36972d7212..197ca6ccc0 100644 --- a/compiler/fn.v +++ b/compiler/fn.v @@ -1057,6 +1057,9 @@ fn (f &Fn) find_misspelled_local_var(name string, min_match f32) string { mut closest := f32(0) mut closest_var := '' for var in f.local_vars { + if var.scope_level > f.scope_level { + continue + } n := name.all_after('.') if var.name == '' || (n.len - var.name.len > 2 || var.name.len - n.len > 2) { continue } p := strings.dice_coefficient(var.name, n)