Skip to content

Commit

Permalink
IL name override fix (#1178)
Browse files Browse the repository at this point in the history
Bugs fixed:
- Overriding the IL name of a class with `@IL.name` generates in incorrect IL
  • Loading branch information
degory authored May 19, 2024
1 parent 1051835 commit a055b96
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
]
},
"ghul.compiler": {
"version": "0.8.45",
"version": "0.8.46",
"commands": [
"ghul-compiler"
]
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>0.8.46-alpha.4</Version>
<Version>0.8.47-alpha.5</Version>
<NoWarn>$(NoWarn);NU1507</NoWarn>
</PropertyGroup>
<ItemGroup>
Expand Down
16 changes: 0 additions & 16 deletions src/semantic/dotnet/type_details.ghul
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,6 @@ namespace Semantic.DotNet is
self.version_number = version_number;
si

init(
dotnet_type: TYPE,
assembly_name: string,
version_number: string
) is
assert dotnet_type? else "dotnet_type is null";

self.dotnet_type = dotnet_type;

self.ghul_namespace = dotnet_type.`namespace;
self.ghul_type_name = dotnet_type.name;
self.il_name = dotnet_type.name;
self.assembly_name = assembly_name;
self.version_number = version_number;
si

matches(namespace_name: string, name: string) -> bool =>
namespace_name =~ ghul_namespace /\ name =~ ghul_type_name;

Expand Down
11 changes: 6 additions & 5 deletions src/semantic/symbols/classy.ghul
Original file line number Diff line number Diff line change
Expand Up @@ -396,16 +396,20 @@ namespace Semantic.Symbols is
buffer.append(".");
si

gen_dotted_name(buffer: System.Text.StringBuilder, qualifying: Scope) is
gen_dotted_name(buffer: System.Text.StringBuilder, qualifying: Scope) is
let iln = il_name_override;

if iln? then
let parts = il_name_override.split(['[',']']);

if parts.count == 3 then
buffer
.append(parts[2]);
else
if owner? /\ !iln.contains('.') then
owner.gen_dotted_name(buffer, self);
fi

buffer.append(iln);
fi
else
Expand Down Expand Up @@ -1057,9 +1061,6 @@ namespace Semantic.Symbols is

declare(location, `field, symbol_definition_listener);

// FIXME: this doesn't seem like it does anything
`field.il_name_override = `field.il_name_override;

`field.set_type(type);

_captures.add(`field);
Expand Down
19 changes: 9 additions & 10 deletions src/semantic/symbols/symbol.ghul
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,16 @@ namespace Semantic.Symbols is

qualified_name: string =>
if owner? then
return owner.qualify(name);
owner.qualify(name);
else
return name;
name;
fi;

il_name: string =>
if il_name_override? then
return il_name_override;
il_name_override;
else
return "'{name}'";
"'{name}'";
fi;

il_name_override: string public;
Expand All @@ -151,15 +151,14 @@ namespace Semantic.Symbols is

specialized_from: Symbol public;

root_specialized_from: Symbol is
let sf = specialized_from;
root_specialized_from: Symbol =>
let sf = specialized_from in

if sf? then
return sf.root_specialized_from;
sf.root_specialized_from;
else
return self;
fi
si
self;
fi;

access: ACCESS => ACCESS.PUBLIC;

Expand Down
2 changes: 1 addition & 1 deletion src/syntax/process/declare_symbols.ghul
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ namespace Syntax.Process is
fi

if is_primitive then
symbol.il_is_primitive_type = true;
symbol.il_is_primitive_type = true;
fi

symbol.il_name_override = il_name;
Expand Down

0 comments on commit a055b96

Please sign in to comment.