Skip to content

Compiler: module values incorrectly brought into scope #1968

@alex-snezhko

Description

@alex-snezhko

With the following example module:

module A

provide enum Variant {
  VariantA,
  VariantB
}

A consuming module will experience strange behavior with regards to accessing the definitions defined in the module

module B

include "./a"

// compiles as expected
print(A.VariantA)
// fails to compile as expected, since `VariantB` hasn't been directly extracted from the module
print(VariantB)

// compiles even though `VariantB` hasn't been brought into scope from the module
print(A.VariantA == VariantB)

At first glance it appears that the entire module is brought into scope for the expression hence why A.VariantA == VariantB compiles

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions