Lyricdev
GitHub

LYR-RES0007

two files that are the same module

error ยท spec 04-modules

Two source files of a package map to the same module path, for example src/geo/point.lyr and src/geo.point.lyr, which are both app.geo.point. Reported where every file of the package is compiled: when a library is built, and by lyric test.

Explanation

A module's name is its file's path below src/, with the directories and the file name joined by dots. A dot inside a file name therefore names the same module as a directory would, and two files would claim one name.

Keep one of the two files; name files without dots.

Example

$ ls -R src
src:
geo  geo.point.lyr  lib.lyr

src/geo:
point.lyr
$ lyric5 build
error[LYR-RES0007]: module 'app.geo.point' is declared by more than one file
 --> src/geo/point.lyr:1:1
  |
1 | pub fn origin(): int {
  | ^^^^^^^^^^^^^^^^^^^^^^
...
note: also declared here
 --> src/geo.point.lyr:1:1