mirror of
https://github.com/roc-lang/roc.git
synced 2025-07-29 09:23:46 +00:00
Detect and report module names that don't match what they are used as
Prior to this commit, if you had a module structure like ``` | - A.roc | - Dep | - B.roc ``` where `B.roc` was defined as ``` interface B exposes [] imports [] ``` and `A.roc` was defined as ``` interface A exposes [] imports [Dep.B] ``` The compiler would hang on you. The reason is that even though we expect `B` to be named `Dep.B` relative to `A`, that would not be enforced. With this patch, we now enforce such naming schemes - a module must have the namespaced name it is referenced by. Currently, we determine the expected namespaced name by looking at how transitive dependencies of the root module reference the module. In the future, once we have a package ecosystem and a solid idea of "package roots", we can use the "package root" to determine how a module should be named. Closes #4094
This commit is contained in:
parent
a5ebd7f477
commit
0cc9ea4b05
5 changed files with 227 additions and 18 deletions
|
@ -2,7 +2,7 @@ use roc_region::all::{Position, Region};
|
|||
use std::fmt;
|
||||
|
||||
/// A position in a source file.
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct State<'a> {
|
||||
/// The raw input bytes from the file.
|
||||
/// Beware: original_bytes[0] always points the the start of the file.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue