Skip to content

Commit

Permalink
Merge pull request #124 from AIexandrKotov/patch-#121
Browse files Browse the repository at this point in the history
fix #121
  • Loading branch information
AIexandrKotov authored Jun 1, 2024
2 parents 2c64a81 + 92b2e21 commit 1ca8873
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
16 changes: 16 additions & 0 deletions SLThree/Methods/GenericMethod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,19 @@ public override ref TypenameExpression GetPlacer()
throw new NotImplementedException();
}
}
public class DictionaryCreator : GenericInfo<CreatorDictionary>, IComplexedGenericInfo
{
public bool IsTypeOfValue;
public DictionaryCreator(CreatorDictionary concrete, int position, bool isTypeOfValue) : base(concrete, position)
{
IsTypeOfValue = isTypeOfValue;
}
public override ref TypenameExpression GetPlacer()
{
if (IsTypeOfValue) return ref Concrete.DictionaryType[1];
else return ref Concrete.DictionaryType[0];
}
}


public class CastGenericInfo : GenericInfo<CastExpression>
Expand Down Expand Up @@ -282,6 +295,9 @@ public override void VisitExpression(TypenameExpression expression)
Infos.Add(new Reflection(reflection, i, false, j));
}
break;
case CreatorDictionary creatorDictionary:
Infos.Add(new DictionaryCreator(creatorDictionary, i, creatorDictionary.DictionaryType[1].Typename is NameExpression dictKeyTypeName && dictKeyTypeName.Name == Generics[i]));
break;
default:
Infos.Add(GetGenericInfo(place, i));
break;
Expand Down
6 changes: 5 additions & 1 deletion SLThree/SLThree.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
<RepositoryType>git</RepositoryType>
<PackageTags>language;scripts;script-lang</PackageTags>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Version>0.7.0.2988</Version>
<Version>0.7.1.2989</Version>
<AssemblyVersion>$(Version)</AssemblyVersion>
<FileVersion>$(Version)</FileVersion>
<ApplicationIcon>slthree.ico</ApplicationIcon>
<PackageReleaseNotes>Bugfixes:
- Add support for generic dict creators &lt;T, T&gt;{}</PackageReleaseNotes>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net6.0|AnyCPU'">
Expand Down Expand Up @@ -49,6 +51,7 @@

<ItemGroup>
<None Remove="docs\specification" />
<None Remove="docs\versions\0.7.1" />
</ItemGroup>

<ItemGroup>
Expand Down Expand Up @@ -79,6 +82,7 @@
<EmbeddedResource Include="docs\versions\0.5.2" />
<EmbeddedResource Include="docs\versions\0.6.0" />
<EmbeddedResource Include="docs\versions\0.7.0" />
<EmbeddedResource Include="docs\versions\0.7.1" />
</ItemGroup>

</Project>
3 changes: 3 additions & 0 deletions SLThree/docs/versions/0.7.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
------ 0.7.1 Patch ------ [01.06.24]
Bugfixes:
- Add support for generic dict creators <T, T>{} (#121)
1 change: 1 addition & 0 deletions test/executing/__bugs/#121.slt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
newdict = <TKey, TValue>() => <TKey, TValue>{};

0 comments on commit 1ca8873

Please sign in to comment.