Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redefining an imported type is allowed #871

Open
salujajaskeerat opened this issue Jul 2, 2024 · 5 comments · May be fixed by #901 or #902
Open

Redefining an imported type is allowed #871

salujajaskeerat opened this issue Jul 2, 2024 · 5 comments · May be fixed by #901 or #902
Labels
Type: Bug 🐛 Something isn't working

Comments

@salujajaskeerat
Copy link
Contributor

salujajaskeerat commented Jul 2, 2024

Bug Report 🐛

When I try to redefine an imported type in the file, it should throw an error as there should be a name conflict.
For example, below code :

namespace org.accordproject.color@1.0.0

import org.test.color@1.0.0.{doc} 

concept doc {
    o String detail
}

concept files{
    o doc[]  documents
}

Here, I am trying to redefine the concept doc imported above. Should this be allowed?

Expected Behavior

It should throw an error stating the name conflict. As mentioned above, local type doc has two definitions, i.e. [email protected] and [email protected]

Current Behavior

The code gets compiled successfully. Inside the concept files, the type doc gets resolved to [email protected], which is from the import statement.

Possible Solution

In concerto/core inside the model file validation, we test if the declaration has unique names or not. We don't check with the imported types there. Just checking there with the imports could fix this issue.

Check the validation code here.

// Check if names of the declarations are unique.

@mttrbrts mttrbrts added the Type: Bug 🐛 Something isn't working label Jul 2, 2024
@aryan917
Copy link

you can modify it better as short and precise.
concept doc {
o String title
o Date created Date
o String content
}

concept files {
o doc[] documents
}

@salujajaskeerat salujajaskeerat linked a pull request Sep 7, 2024 that will close this issue
5 tasks
@yashsaraswat2004
Copy link

please assign this issue to me

@salujajaskeerat
Copy link
Contributor Author

salujajaskeerat commented Sep 11, 2024

please assign this issue to me

@yashsaraswat2004 It is great so see your motivation towards contributing to this issue and concerto in general . Currently we (Internally) are working on closing this issue already so i would suggest you to pickup some different issue. I suggest you to join Accord discord channel and explore concerto more.

@dselman
Copy link
Sponsor Contributor

dselman commented Sep 24, 2024

Thanks both. I agree this would be a good issue to fix. Note that we recently added support for import aliasing which is useful for name conflicts.

@dselman
Copy link
Sponsor Contributor

dselman commented Oct 8, 2024

What is the status of this please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug 🐛 Something isn't working
Projects
None yet
5 participants