I made an issue 
here: https://github.com/elm-lang/error-message-catalog/issues/150

Perhaps it'll be easier to understand with some examples:
(a)
file name : Main.elm
module name : Main
result : No error is given, just as it should be.

(b)
file name : Main.elm
module name : NotMain
result : ***No error is given, but one should be.***

(c)
file name : Main.elm
module name : notMain
result : An error is given, just as it should be.

A sidenote : Any modules imported by the base module are not affected by 
this (lack of) error in example (b). Only the base module is affected.

On Tuesday, August 2, 2016 at 3:31:23 PM UTC-5, John Bugner wrote:
>
> You misunderstand. The error message that I listed is fine, which is given 
> when the file name is "Main.elm" and the module name is "xMain". The 
> problem that I am documenting here is that when the file name is "Main.elm" 
> and the module name is "NotMain", *no* error is given by the compiler. The 
> module name should be forced to be "Main".
>
> On Tuesday, August 2, 2016 at 3:09:02 PM UTC-5, Joey Eremondi wrote:
>>
>> I'm not sure that the problem is that the filename doesn't match the 
>> module name, but that the module name needs to start with a capital letter.
>>
>> That's why it's a syntax error: the parser is looking for a capitalized 
>> word, and it's not seeing one.
>>
>> Certainly the message could be more clear and better documented.
>>
>> On Tue, Aug 2, 2016 at 12:50 PM, John Bugner <[email protected]> wrote:
>>
>>> I'm running Elm 0.17.1, and the compiler doesn't care whether the *name 
>>> given in the module declaration* of the module being compiled (with either 
>>> elm-make or elm-reactor) matches the *file name*.
>>>
>>> However, the compiler *does* catch if the name in the module declaration 
>>> doesn't start with a capital letter, as seen below:
>>>
>>> -- SYNTAX PROBLEM ------------------------------------------------- 
>>> src\Main.elm
>>>
>>> I ran into something unexpected when parsing your code!
>>>
>>> 1| module xNotMain exposing (..)
>>>           ^
>>> I am looking for one of the following things:
>>>
>>>     the name of this module
>>>     whitespace
>>>
>>>
>>> But, if I turn `xNotMain` into `NotMain`, then the compiler succeeds, 
>>> and the program works as intended, despite the name in the module 
>>> declaration still not matching the file name. Note, however, that any 
>>> imported modules *are* checked!, but *not* the "base" file itself.
>>>
>>> Where should I submit this error? 
>>> github.com/elm-lang/error-message-catalog/issues ?. Technically it is 
>>> not an error message, but the lack of one.
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Elm Discuss" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to