diff --git a/src/internals/ir/builders/imports.ts b/src/internals/ir/builders/imports.ts index 7a732d18..6af5d598 100644 --- a/src/internals/ir/builders/imports.ts +++ b/src/internals/ir/builders/imports.ts @@ -77,10 +77,16 @@ export class ImportGraphBuilder { imports.reduce((acc, importNode) => { const importPath = importNode.path.value; - const resolvedPath = path.resolve( + let resolvedPath = path.resolve( path.dirname(filePath), this.resolveStdlibPath(importPath), ); + // TODO: We should use a Tact API function call when this is fixed: + // https://github.com/tact-lang/tact/issues/982 + resolvedPath = + resolvedPath.endsWith(".tact") || resolvedPath.endsWith(".fc") + ? resolvedPath + : resolvedPath + ".tact"; const targetNodeIdx = this.processFile( resolvedPath, nodes, @@ -111,6 +117,8 @@ export class ImportGraphBuilder { * * Tact API doesn't provide functions to work with paths, so we replicate this: * https://github.com/tact-lang/tact/blob/2315d035f5f9a22cad42657561c1a0eaef997b05/src/imports/resolveLibrary.ts#L26 + * + * TODO: Should be replaced when https://github.com/tact-lang/tact/issues/982 is implemented. */ private resolveStdlibPath(importPath: string): string { const stdlibPrefix = "@stdlib/"; diff --git a/test/all/imports-4/main.tact b/test/all/imports-4/main.tact index afd155b2..99b48583 100644 --- a/test/all/imports-4/main.tact +++ b/test/all/imports-4/main.tact @@ -1,5 +1,6 @@ import "./constants.tact"; import "./messages.tact"; +import "./test"; // Importing without extension import "@stdlib/ownable"; fun test() {} diff --git a/test/all/imports-4/test.tact b/test/all/imports-4/test.tact new file mode 100644 index 00000000..438fd1cb --- /dev/null +++ b/test/all/imports-4/test.tact @@ -0,0 +1 @@ +const A: Int = 42;