Skip to content

The import-reexport problem #54

@Hoblovski

Description

@Hoblovski

相关分支:https://github.com/cloudwego/abcoder/tree/fix/reexport

在 rust 和 python 中,存在一种情况是一个文件 import 了一个符号以后,从自己的位置 export 出去

// rust
// (文件是 cur.rs, pkgPath is cur)
mod foo;		// 子模块是 private 的
pub use foo::bar;	// 但是 bar 函数是 public 的
			// 这个 pkg 的 user 应当通过 cur::bar 来访问 bar
			//	不能通过 cur::foo::bar,会产生错误

// python
from math import cos // 当前文件 export 了 cos

在 Rust 的情况中,我们应当确保 cur::bar 是外部可见的.
现在的实现里,pkgPath=cur 的地方没有 bar,但是 pkgPath=cur::foo 里有 bar。
这可能让大模型认为 bar 的用法是 cur::foo::bar

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions