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

module level log.fatal is not marked as @[noreturn] #22985

Closed
Le0Developer opened this issue Nov 27, 2024 · 0 comments · Fixed by #22986
Closed

module level log.fatal is not marked as @[noreturn] #22985

Le0Developer opened this issue Nov 27, 2024 · 0 comments · Fixed by #22986
Assignees
Labels
Bug This tag is applied to issues which reports bugs. Status: Confirmed This bug has been confirmed to be valid by a contributor. Unit: vlib Bugs/feature requests, that are related to the vlib.

Comments

@Le0Developer
Copy link
Member

Le0Developer commented Nov 27, 2024

Describe the bug

log.fatal (NOT log.Log.fatal!) is not marked as @[noreturn]

Reproduction Steps

import log

fn mkerr() !string {
  return error("hi")
}

fn main() {
  a := mkerr() or {
    log.fatal('hello there!')
  }
  println(a)
}

Expected Behavior

Successful compilation, panic at runtime

Current Behavior

repro.v:9:9: error: `or` block must provide a default value of type `string`, or return/continue/break or call a @[noreturn] function like panic(err) or exit(1)
    7 | fn main() {
    8 |     a := mkerr() or {
    9 |     log.fatal('hello there!')
      |         ~~~~~~~~~~~~~~~~~~~~~
   10 |   }
   11 |     println(a)

Possible Solution

Simply add @[noreturn] to the function

Additional Information/Context

No response

V version

V 0.4.8 c1df71a

Environment details (OS name and version, etc.)

V full version: V 0.4.8 c1df71a
OS: macos, macOS, 15.1.1, 24B2091
Processor: 10 cpus, 64bit, little endian, Apple M4

getwd: /Users/leodev/v
vexe: /Users/leodev/v/v
vexe mtime: 2024-11-27 09:17:53

vroot: OK, value: /Users/leodev/v
VMODULES: OK, value: /Users/leodev/.vmodules
VTMP: OK, value: /tmp/v_501

Git version: git version 2.47.0
Git vroot status: c1df71a (22 commit(s) behind V master)
.git/config present: true

CC version: Apple clang version 16.0.0 (clang-1600.0.26.4)
emcc version: N/A
thirdparty/tcc status: thirdparty-macos-arm64 713692d4

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

Huly®: V_0.6-21426

@Le0Developer Le0Developer added the Bug This tag is applied to issues which reports bugs. label Nov 27, 2024
@Le0Developer Le0Developer self-assigned this Nov 27, 2024
@felipensp felipensp added Unit: Checker Bugs/feature requests, that are related to the type checker. Status: Confirmed This bug has been confirmed to be valid by a contributor. Unit: vlib Bugs/feature requests, that are related to the vlib. and removed Unit: Checker Bugs/feature requests, that are related to the type checker. labels Nov 27, 2024
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. Unit: vlib Bugs/feature requests, that are related to the vlib.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants