8000 ModelManager fails to throw semantic errors for multiple imports from the same namespace and name conflict with imported types · Issue #1023 · accordproject/concerto · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
ModelManager fails to throw semantic errors for multiple imports from the same namespace and name conflict with imported types #1023
Open
@Anshukumar123975

Description

@Anshukumar123975

Bug Report 🐛

The ModelManager fails to throw semantic validation errors in the following two scenarios, which violate the expected behavior as per the Concerto modeling rules:

1. MODEL_FILE_002: Cannot import multiple declarations from the same namespace using separate import statements

Valid syntax (single import statement):

import org.external.types.{Type, AnotherType}

Invalid syntax (multiple separate imports from same namespace):

import org.external.types.Type
import org.external.types.AnotherType

File: model_file_002_duplicate_namespace_imports.cto:

namespace org.example.bad

import org.external.types.Type
import org.external.types.AnotherType

enum Thing {
  o ISSUE
}

File: importedTypes.cto:

namespace org.external.types

enum Type {
  o VALUE
}

enum AnotherType {
  o VALUE
} 

Image

ModelManager.validateModelFiles() does not throw an error here, but it should throw an error due to multiple imports from the same namespace.

2. DECLARATION_002: Declared name conflicts with imported type:

Should throw an error if a local declaration reuses an imported name

File: declaration_002_conflict_with_imported_type.cto:

namespace org.example.conflict

import org.external.types.Type

enum Type {
  o OTHER
}

File: importedTypes.cto:

namespace org.external.types

enum Type {
  o VALUE
}

Image

ModelManager.validateModelFiles() does not detect this name conflict even though the declared type Type shadows the imported one, violating namespace/type safety.

Expected Behavior

ModelManager.validateModelFiles() should throw an error if:

  1. Multiple import statements are used for the same namespace.
  2. A local declaration uses the same name as an imported type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0