Namespace overlap error is missing filename/location #378

Closed
opened 2022-04-28 00:15:13 +09:00 by zxq9 · 7 comments
zxq9 commented 2022-04-28 00:15:13 +09:00 (Migrated from gitlab.com)

Created by: dincho

Compiling of the contract:

@compiler >= 6

include "BLS12_381.aes"

namespace BLS12_381 =
    type fp = int

main contract Bug =
    type number = int

leads to the following error

Type error in 'contracts/Bug.aes' at line 5, col 11:
The namespace BLS12_381 (at line 5, column 11) has the same name as a namespace at line 1, column 11

which reports wrong namespace location obviously

*Created by: dincho* Compiling of the contract: ``` @compiler >= 6 include "BLS12_381.aes" namespace BLS12_381 = type fp = int main contract Bug = type number = int ``` leads to the following error ``` Type error in 'contracts/Bug.aes' at line 5, col 11: The namespace BLS12_381 (at line 5, column 11) has the same name as a namespace at line 1, column 11 ``` which reports wrong namespace location obviously
zxq9 commented 2022-04-28 00:23:43 +09:00 (Migrated from gitlab.com)

Created by: dincho

Perhaps the compiler annotation is not considered ? 🤔

*Created by: dincho* Perhaps the compiler annotation is not considered ? 🤔
zxq9 commented 2022-04-28 00:24:40 +09:00 (Migrated from gitlab.com)

Created by: dincho

Perhaps the compiler annotation is not considered ? 🤔

Nah, same error (location) with:

include "Set.aes"
include "BLS12_381.aes"

namespace BLS12_381 =
    type fp = int

main contract Bug =
    type number = int
*Created by: dincho* > Perhaps the compiler annotation is not considered ? 🤔 Nah, same error (location) with: ``` include "Set.aes" include "BLS12_381.aes" namespace BLS12_381 = type fp = int main contract Bug = type number = int ```
zxq9 commented 2022-04-28 00:25:48 +09:00 (Migrated from gitlab.com)

Created by: hanssv

It is line 1, column 11 in BLS12_381.aes, right?

*Created by: hanssv* It is line 1, column 11 in `BLS12_381.aes`, right?
zxq9 commented 2022-04-28 01:31:19 +09:00 (Migrated from gitlab.com)

Created by: dincho

Sure, but then the file/where (BLS12_381.aes, ) is missing ?

*Created by: dincho* Sure, but then the file/where (BLS12_381.aes, ) is missing ?
zxq9 commented 2022-04-28 01:35:17 +09:00 (Migrated from gitlab.com)

Created by: dincho

For example the buildin namespace error makes much more sense:

Type error in 'contracts/Bug.aes' at line 5, col 11:
The namespace MCL_BLS12_381 (at line 5, column 11) has the same name as a namespace at (builtin location)

So I'd expect:

The namespace BLS12_381 (at line 5, column 11) has the same name as a namespace at line 1, column 11 in BLS12_381.aes

*Created by: dincho* For example the buildin namespace error makes much more sense: > Type error in 'contracts/Bug.aes' at line 5, col 11: > The namespace MCL_BLS12_381 (at line 5, column 11) has the same name as a namespace at (builtin location) So I'd expect: > The namespace BLS12_381 (at line 5, column 11) has the same name as a namespace at line 1, column 11 in BLS12_381.aes
zxq9 commented 2022-04-28 01:40:24 +09:00 (Migrated from gitlab.com)

Created by: dincho

Not very helpful with user defined namespaces as well:

➜  cat contracts/Bug.aes                   
@compiler >= 6

include "Bug2.aes"

namespace Busy =
    type bus = int

main contract Bug =
    type number = int

➜ cat contracts/Bug2.aes                  
@compiler >= 6

namespace Busy =
    type bus = int

➜ aesophia_cli contracts/Bug.aes          
Type error in 'contracts/Bug.aes' at line 5, col 11:
The namespace Busy (at line 5, column 11) has the same name as a namespace at line 3, column 11
*Created by: dincho* Not very helpful with user defined namespaces as well: ``` ➜ cat contracts/Bug.aes @compiler >= 6 include "Bug2.aes" namespace Busy = type bus = int main contract Bug = type number = int ➜ cat contracts/Bug2.aes @compiler >= 6 namespace Busy = type bus = int ➜ aesophia_cli contracts/Bug.aes Type error in 'contracts/Bug.aes' at line 5, col 11: The namespace Busy (at line 5, column 11) has the same name as a namespace at line 3, column 11 ```
zxq9 commented 2022-04-28 06:21:45 +09:00 (Migrated from gitlab.com)

Created by: hanssv

@ghallak is this something that could be improved?

*Created by: hanssv* @ghallak is this something that could be improved?
Sign in to join this conversation.
No Milestone
No project
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: QPQ-AG/sophia#378
No description provided.