Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

private value referenced from inline causes import error #3866

Copy link
Copy link

Description

@joprice
Issue body actions

Description

When an inline value references a private value, the generated inlined code attempts to import the private value, which is not exported, causing an import error.

Repro code

Reproducing requires multiple files, so I made a reproduction repository:

https://github.com/joprice/fable-repro/blob/2283eb46351bef3cc39ac02e9c5c4c303c7b6a8b/Client.fs#L10

An overview of the problem:

In one file:

module Client

let private x = 1
let inline y () = x

In another file:

Client.y()

This will generate an error like

import { x } from "./Client.fs.js";
         ^
SyntaxError: The requested module './Client.fs.js' does not provide an export named 'x'

Expected and actual results

Compilation should fail if an inline value references a private value, if the private value is not itself inline, instead of generating invalid code.

For comparison, fsc returns the following error in this case:

The value 'direct' was marked inline but its implementation makes use of an internal or private function which is not sufficiently accessible

Related information

  • Fable version: 4.19.3
  • Operating system: OSX
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.