rsdn / nitra

Nitra is a language workbench
Apache License 2.0
145 stars 11 forks source link

Inconsistent behaviour of using-statements #20

Open ssrmm opened 8 years ago

ssrmm commented 8 years ago

using-statements in syntax modules apply to the scope they are declared in:

namespace Foo
{
  syntax module Bar
  {
    using Nitra.Core;

    [StartRule]
    syntax Start = "foo" sm "bar"; // Nitra.Core visible here
  }
}

For namespaces however this is not not the case. The types opened by the using-statement are only visible in nested namepaces:

namespace Foo
{
  using Nitra;
  using Nitra.Declarations;

  declaration Root : Container {} // error : Unbound name 'Container'

  namespace Bar
  {
    declaration Root : Container {} // works fine in here
  }
}

This is somewhat inconsistent and should be changed so that elements opened through the using-statement are visible in the scope of that using-statement.