File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -106,7 +106,26 @@ impl BuildState {
106
106
}
107
107
108
108
pub fn get_module ( & self , module_name : & str ) -> Option < & Module > {
109
- self . modules . get ( module_name)
109
+ // Try exact match first
110
+ if let Some ( module) = self . modules . get ( module_name) {
111
+ return Some ( module) ;
112
+ }
113
+ // Fallback: try with first letter uncapitalized (legacy behavior)
114
+ // This matches the logic in compiler/gentype/ModuleResolver.ml:
115
+ // match map |> ModuleNameMap.find module_name with
116
+ // | resolved_module_dir -> Some (resolved_module_dir, Uppercase, bs_dependencies)
117
+ // | exception Not_found -> (
118
+ // match map |> ModuleNameMap.find (module_name |> ModuleName.uncapitalize)
119
+ // with | resolved_module_dir -> Some (resolved_module_dir, Lowercase, bs_dependencies)
120
+ // | exception Not_found -> None)
121
+ if let Some ( first_char) = module_name. chars ( ) . next ( ) {
122
+ if first_char. is_ascii_uppercase ( ) {
123
+ let mut uncapitalized = first_char. to_lowercase ( ) . collect :: < String > ( ) ;
124
+ uncapitalized. push_str ( & module_name[ 1 ..] ) ;
125
+ return self . modules . get ( & uncapitalized) ;
126
+ }
127
+ }
128
+ None
110
129
}
111
130
pub fn new (
112
131
project_root : PathBuf ,
You can’t perform that action at this time.
0 commit comments