V11

Warning

Vocabulary

V11 — A component named like a built-in

A component the project declares takes the place of a built-in of its name: every call of the name draws the project's own, so the built-in cannot be placed in that project. A new built-in never changes what an existing project draws.

What the compiler said

info[V11]: `Chart` is this project's component, so a call of that name draws it rather than the built-in `Chart` --> src/App.wf:1:1 | 1 | component Chart(_ title: String) { | ^^^^^^^^^ = help: To place the built-in too, rename this one — `MyChart`, `ReportChart` — and its call sites = docs: https://webfluent.monzeromer.dev/errors/V11

The fix

Broken

wf

component Chart(_ title: String) { Text(title) } page P(path: "/", title: "T", description: "D") { Heading("Sales").h1 Chart("Sales by month") }

Fixed

wf

component SalesTitle(_ title: String) { Text(title) } page P(path: "/", title: "T", description: "D") { Heading("Sales").h1 SalesTitle("Sales by month") Chart(kind: .bar, data: [3, 5, 2]) }

Nothing needs fixing. To place the built-in too, rename the component and its call sites; to stop the note, set "lints": { "V11": "off" }.

Each example is a whole program: it is all of src/App.wf in a project with no other .wf file (trying an example).

Why this rule exists

A component the project declares takes the place of a built-in of the same name: every call of the name draws the project's own component. This is information (info), not a warning. Nothing is wrong, and a new built-in in a later WebFluent never changes what an existing project draws. The one thing to know is that the built-in of that name cannot be placed in this project.

To use the built-in as well, rename the component and its call sites:

lints may lower it:

"lints": { "V11": "off" } // wf-allow(V11)