Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug using map on or error handling #12164

Closed
igotfr opened this issue Oct 12, 2021 · 0 comments · Fixed by #22180
Closed

Bug using map on or error handling #12164

igotfr opened this issue Oct 12, 2021 · 0 comments · Fixed by #22180
Labels
Bug This tag is applied to issues which reports bugs. Status: Confirmed This bug has been confirmed to be valid by a contributor.

Comments

@igotfr
Copy link
Contributor

igotfr commented Oct 12, 2021

V doctor:

OS: windows, Microsoft Windows 10 Pro v19041 64 bits
Processor: 4 cpus, 64bit, little endian, Intel(R) Core(TM) i5-2500 CPU @ 3.30GHz
CC version: Error: exec failed (CreateProcess) with code 2: O sistema não pode encontrar o arquivo especificado.

 cmd: cc --version

getwd: C:\Users\Usuario\pv
vmodules: C:\Users\Usuario\.vmodules
vroot: C:\Users\Usuario\v
vexe: C:\Users\Usuario\v\v.exe
vexe mtime: 2021-10-11 13:59:48
is vroot writable: true
is vmodules writable: true
V full version: V 0.2.4 6c6bb08

Git version: Error: exec failed (CreateProcess) with code 2: O sistema não pode encontrar o arquivo especificado.

 cmd: git --version
Git vroot status: Error: exec failed (CreateProcess) with code 2: O sistema não pode encontrar o arquivo especificado.

 cmd: git -C . describe --abbrev=8 --dirty --always --tags
.git/config present: false
thirdparty/tcc status: Error: exec failed (CreateProcess) with code 2: O sistema não pode encontrar o arquivo especificado.

 cmd: git -C thirdparty/tcc rev-parse --abbrev-ref HEAD Error: exec failed (CreateProcess) with code 2: O sistema não pode encontrar o arquivo especificado.

 cmd: git -C thirdparty/tcc describe --abbrev=8 --dirty --always --tags

What did you do?
v -g -o vdbg cmd/v && vdbg .\teste.v

struct MyError {
  msg string
  code int
}

type MapString = map[string]string | int

fn f() ?MapString {
  return IError(MyError{msg: 'String Error'})
}

fn main() {
  println(f() or { { 'abc': err.msg } })
}

What did you expect to see?

MapString({'abc': 'String Error'})

with println(f() or { map{ 'abc': err.msg } }) works normally with warning

What did you see instead?

.\teste.v:13:22: error: expression evaluated but not used
   11 | 
   12 | fn main() {
   13 |   println(f() or { { 'abc': err.msg } })
      |                      ~~~~~
   14 | }```

with `println(f() or { map{ 'abc': err.msg } })` works normally with warning
@medvednikov medvednikov added the Bug This tag is applied to issues which reports bugs. label Jul 19, 2022
@medvednikov medvednikov added the Status: Confirmed This bug has been confirmed to be valid by a contributor. label Aug 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs. Status: Confirmed This bug has been confirmed to be valid by a contributor.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants