Skip to content

Conversation

@kbkpbot
Copy link
Contributor

@kbkpbot kbkpbot commented Sep 21, 2025

Feature requested by #25183

NOTE: vfmt need further fix to work with new array syntax, in anther PR.

new.v

module main

const kkk = 20

fn main() {
        // old syntax
        o1 := []int{}
        dump(o1)
        o2 := [int(1),2,3,4]
        dump(o2)
        o3 := [kkk]int{}
        dump(o3)
        o4 := [int(1),2,3,4]!
        dump(o4)

        // new syntax
        n1 := []int[1 2 3 4]
        dump(n1)
        n2 := [4]int[1 2 3 4]
        dump(n2)
        n3 := [..]int[1 2 3 4]
        dump(n3)
        /*
        // not work yet
        n4 := [4][4]f32[
                 [1 2 3 4]
                 [5 5 4 2]
                 [0 1 3 0]
                 [0 1 4 1]
        ]
        dump(n4)
        n5 := [..][..]f32[
                 [1 2 3 4]
                 [5 5 4 2]
                 [0 1 3 0]
                 [0 1 4 1]
        ]
        dump(n5)
        */
}

@kbkpbot kbkpbot marked this pull request as draft September 21, 2025 13:51
@vlang vlang deleted a comment from huly-for-github bot Sep 21, 2025
@kbkpbot
Copy link
Contributor Author

kbkpbot commented Sep 21, 2025

autofree has some bug, need to fix in another PR.
Issue #25366

@spytheman
Copy link
Member

You can use this as a workaround for the autofree compilation:

41|  |-    pre_cmnts = p.eat_comments()
  |41|+    pre_cmnts.clear()
  |42|+    pre_cmnts << p.eat_comments()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants