zopencommunity / wharf

Apache License 2.0
6 stars 4 forks source link

Successful port but get panic: unsanitized config used for doing porting of depenendencies #38

Closed bluecivet closed 3 months ago

bluecivet commented 7 months ago

Porting https://github.com/onsi/ginkgo.git using Wharf but I get

Build errors occurred in: github.com/onsi/ginkgo/v2
panic: unsanitized config used for doing porting of depenendencies [recovered]
        panic: unsanitized config used for doing porting of depenendencies

However, the error causes it to look unreasonable

 core_dsl.go:300:59: cannot use suiteLabels (variable of type "github.com/onsi/ginkgo/v2/internal".Labels) as "github.com/onsi/ginkgo/v2/internal".Labels value in argument to global.Suite.Run

This looks like a type mismatch, but the type is correct.

The same thing happens when porting https://github.com/u-root/u-root.git

bluecivet commented 5 months ago

The issue arises within the type checking process, specifically in the func AssignableTo(V, T Type) bool function, which fails to provide accurate type checks for Named type. .

The function relies on indenticalOrigin to verify the original type. However, the problem lies in its use of the == operator to compare Name structs that include pointers. This comparison method can lead to inaccurate results as it checks memory addresses rather than the actual content of the structs.

Compounding this issue is Wharf's behavior of creating a new package instance each time it filters a configuration. Consequently, pointers within Name structs may differ between package instances.

// identicalOrigin reports whether x and y originated in the same declaration.
func identicalOrigin(x, y *Named) bool {
    // TODO(gri) is this correct?
    return x.Origin().obj == y.Origin().obj
}
// An object implements the common parts of an Object.
type object struct {
    parent    *Scope
    pos       token.Pos
    pkg       *Package
    name      string
    typ       Type
    order_    uint32
    color_    color
    scopePos_ token.Pos
}
MacMalainey commented 4 months ago

Is this fixed @bluecivet ?