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

Casting alias to array fail #10763

Open
elliotchance opened this issue Jul 11, 2021 · 0 comments · May be fixed by #19999
Open

Casting alias to array fail #10763

elliotchance opened this issue Jul 11, 2021 · 0 comments · May be fixed by #19999
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: Parser Bugs/feature requests, that are related to the V parser or syntax (*not* semantic ones).

Comments

@elliotchance
Copy link
Contributor

V doctor:

OS: macos, macOS, 11.2.3, 20D91
Processor: 8 cpus, 64bit, little endian, Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz
CC version: Apple clang version 12.0.5 (clang-1205.0.22.11)

getwd: /Users/elliot/v/src/github.com/elliotchance/v-bigint
vmodules: /Users/elliot/.vmodules
vroot: /Users/elliot/v
vexe: /Users/elliot/v/v
vexe mtime: 2021-07-05 22:56:24
is vroot writable: true
is vmodules writable: true
V full version: V 0.2.2 9e61321

Git version: git version 2.30.1 (Apple Git-130)
Git vroot status: Error: fatal: not a git repository (or any of the parent directories): .git
.git/config present: false
thirdparty/tcc status: thirdparty-macos-amd64 689c8a02-dirty

What did you do?
v -g -o vdbg cmd/v && vdbg bug/cast_slice.v

type Ints = []int

values := Ints([5, 7, 9])
valuesAsIntArray := []int(values)

println(valuesAsIntArray)

What did you expect to see?

[5, 7, 9]

What did you see instead?

bug/cast_slice.v:4:21: warning: use `x := []Type{}` instead of `x := []Type`
    2 | 
    3 | values := Ints([5, 7, 9])
    4 | valuesAsIntArray := []int(values)
      |                     ~~~~~~
    5 | 
    6 | println(valuesAsIntArray)
bug/cast_slice.v:4:26: error: expression evaluated but not used
    2 | 
    3 | values := Ints([5, 7, 9])
    4 | valuesAsIntArray := []int(values)
      |                          ~~~~~~~~
    5 | 
    6 | println(valuesAsIntArray)
@medvednikov medvednikov added the Bug This tag is applied to issues which reports bugs. label Jul 19, 2022
@ArtemkaKun ArtemkaKun changed the title Casting alias slice back to original type? Casting alias to array fail Jan 17, 2023
@ArtemkaKun ArtemkaKun added Status: Confirmed This bug has been confirmed to be valid by a contributor. Unit: Parser Bugs/feature requests, that are related to the V parser or syntax (*not* semantic ones). labels Jan 17, 2023
@felipensp felipensp self-assigned this Nov 26, 2023
@felipensp felipensp linked a pull request Nov 26, 2023 that will close this issue
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: Parser Bugs/feature requests, that are related to the V parser or syntax (*not* semantic ones).
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants