diff --git a/compiler/scanner.v b/compiler/scanner.v index 24d423cf0a..5ee9164bb3 100644 --- a/compiler/scanner.v +++ b/compiler/scanner.v @@ -438,6 +438,22 @@ fn (s mut Scanner) scan() ScanRes { else { return scan_res(.gt, '') } + case 0xE2: + //case `≠`: + if nextc == 0x89 && s.text[s.pos + 2] == 0xA0 { + s.pos += 2 + return scan_res(.ne, '') + } + // ⩽ + else if nextc == 0x89 && s.text[s.pos + 2] == 0xBD { + s.pos += 2 + return scan_res(.le, '') + } + // ⩾ + else if nextc == 0xA9 && s.text[s.pos + 2] == 0xBE { + s.pos += 2 + return scan_res(.ge, '') + } case `<`: if nextc == `=` { s.pos++ diff --git a/vlib/builtin/int_test.v b/vlib/builtin/int_test.v index b2f669b074..32d22aaa52 100644 --- a/vlib/builtin/int_test.v +++ b/vlib/builtin/int_test.v @@ -9,3 +9,9 @@ fn test_const() { assert a == 3 assert u == u64(1) } + +fn test_cmp() { + assert 1 ≠ 2 + assert 1 ⩽ 2 + assert 1 ⩾ 0 +}