Skip to content

Unresolved reference on slices declared as types #1846

@vburenin

Description

@vburenin

Hey folks. This is unresolved reference on slices, round two.
SomeId member highlighted as unresolved.

Originating bug has been fixed, however in that case object was created using NewDataSlice. This time I created a data structure in place: data := &DataSlice{} and as data := DataSlice{}

I am using 488 build of Go plugin.

type TestStruct struct { SomeId int } type DataSlice []*TestStruct func NewDataSlice() *DataSlice { return &DataSlice{} } func ErrorCode() { data := DataSlice{} for _, element := range data { if element.SomeId > 20 { println("some text") } } }

One more example:

type TestStruct struct { SomeId int } type DataSlice []*TestStruct func NewDataSlice() *DataSlice { return &DataSlice{} } func ErrorCode() { data := DataSlice{} for _, element := range *data { if element.SomeId > 20 { println("some text") } } }

image

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions