Skip to content

Returning private struct from public function works without [noinit] #18427

@Molochnikov

Description

@Molochnikov

Describe the bug

Returning private struct from public function works without [noinit]

Expected Behavior

Some error maybe

Current Behavior

test.Person{
    name: 's'
    age: 0
}

Reproduction Steps

module test

struct Person {
	name string = 'test'
	age  int
}

pub fn say_hi() Person {
	return Person {
		name: "s"
		age: 0
	}
}
import test

a := test.say_hi()
dump(a)

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.3.4 c0843af

Environment details (OS name and version, etc.)

Windows 11

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugThis tag is applied to issues which reports bugs.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions