Class NoNameCollisionOrError

java.lang.Object
org.ek9lang.compiler.support.NoNameCollisionOrError
All Implemented Interfaces:
BiPredicate<IScope,ISymbol>

public class NoNameCollisionOrError extends Object implements BiPredicate<IScope,ISymbol>
Designed to check if variable name and method names collide with Type/Function names.
  • Constructor Details

    • NoNameCollisionOrError

      public NoNameCollisionOrError(ErrorListener errorListener, boolean useQualifiedName)
  • Method Details

    • test

      public boolean test(IScope inScope, ISymbol symbol)
      Check for exising symbol in the scope. if returns true then errors will have been added to the error listener.
      Specified by:
      test in interface BiPredicate<IScope,ISymbol>
    • errorsIfLocalNamedLikeAMethod

      public boolean errorsIfLocalNamedLikeAMethod(IAggregateSymbol aggregate, ISymbol symbol)
      A LOCAL variable may not take the name of a method of the type it is declared in (its own - private included - or one it inherits or takes from a trait, unless that one is private and so unreachable here): total <- total() means a value on the left and a call on the right, and with the local in scope a bare 'total()' no longer reaches the method (it surfaced as E50010 'type not resolved', 2026-10-01). Fields and parameters are not locals - a constructor parameter named like its field is the common, intended form - and keep their names. A local holding a FUNCTION (a delegate) is left to its own, more specific E02080 by the caller. Run once the hierarchy is complete (TYPE_HIERARCHY_CHECKS): before that a class's supers and traits are not yet attached.
    • errorsIfResolved

      public boolean errorsIfResolved(IScope inScope, ISymbol symbol, SymbolSearch search, ErrorListener.SemanticClassification classificationError)
      If a symbol is resolved then this will emit an error.