Skip to content

Test vlib/v/tests/aliases/modules/value/value_test.v failed in a single file #26103

@Krchi

Description

@Krchi

Describe the bug

It's ok in test, but failed in a single main file
same problem in playground, https://play.vlang.io/p/2222017414

Reproduction Steps

module main

pub interface Value {
	str() string
}

pub type List = []Value

pub fn (x List) str() string {
	return x.str()
}

fn main() {
	mut list := make_list()!
	assert (list as List).len == 0
}

fn make_list() !Value {
	mut list := List{}
	return list
}

Expected Behavior

compile the code

Current Behavior

/Users/krchi/Desktop/vlang/v /Users/krchi/Documents/v_demo/examples/hello -color -g -no-parallel -no-retry-compilation -keepc -g -keepc
examples/hello/hello.v:21:2: error: `[]Value` doesn't implement method `str` of interface `Value`
   19 | fn make_list() !Value {
   20 |     mut list := List{}
   21 |     return list
      |     ~~~~~~~~~~~
   22 | }

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.12 0aa3e2d

Environment details (OS name and version, etc.)

mac

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.

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