Skip to content

Commit

Permalink
Hotfix sym-type-void not having an enclosing scope
Browse files Browse the repository at this point in the history
  • Loading branch information
schmalzing committed Nov 30, 2024
1 parent b098ef1 commit 8e2bda2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,15 @@ public static SymTypeOfRegEx createTypeRegEx(String regex) {

/**
* creates the "Void"-type, i.e. a pseudotype that represents the absence of a real type
*
* @return
*/
public static SymTypeVoid createTypeVoid() {
return new SymTypeVoid();
Optional<TypeSymbol> type = BasicSymbolsMill.globalScope()
.resolveTypeLocally(BasicSymbolsMill.VOID);
if (type.isEmpty()) {
Log.error("0x893F63 Internal Error: Non primitive type "
+ BasicSymbolsMill.VOID + " stored as constant.");
}
return new SymTypeVoid(type.orElseThrow());
}

public static SymTypeObscure createObscureType() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@


import de.monticore.symbols.basicsymbols.BasicSymbolsMill;
import de.monticore.symbols.basicsymbols._symboltable.TypeSymbol;
import de.monticore.symbols.basicsymbols._symboltable.TypeSymbolSurrogate;
import de.monticore.types3.ISymTypeVisitor;

Expand All @@ -16,6 +17,10 @@ public SymTypeVoid() {
typeSymbol = new TypeSymbolSurrogate(BasicSymbolsMill.VOID);
typeSymbol.setEnclosingScope(BasicSymbolsMill.scope());
}

protected SymTypeVoid(TypeSymbol symbol) {

}

@Override
public boolean isVoidType() {
Expand Down

0 comments on commit 8e2bda2

Please sign in to comment.