Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

升级 Microsoft.CodeAnalysis.CSharp 和添加文件范围命名空间支持 #42

Merged
merged 5 commits into from
Jan 29, 2024

Conversation

SeWZC
Copy link
Contributor

@SeWZC SeWZC commented Jan 23, 2024

  1. 原来的 Microsoft.CodeAnalysis.CSharp 是 4.2.0 版本的,包含 C# 版本为 C# 10。升级到 4.8.0 以支持 C# 11 和 C# 12 的语法,例如列表模式匹配。如果不升级,在使用列表模式匹配+属性模式匹配时会解析类的范围。
  2. 块范围的命名空间与文件范围的命名空间(C# 10 已支持)在语法解析中是不同的语法节点,需要额外添加对文件范围命名空间的处理。

SeWZC added 2 commits January 23, 2024 14:57
在语法解析中,文件范围命名空间和命名空间是不同的节点
@SeWZC SeWZC requested a review from lindexi January 23, 2024 07:38
@lindexi
Copy link
Member

lindexi commented Jan 23, 2024

@SeWZC 构建失败:

        "D:\a\SourceFusion\SourceFusion\src\TelescopeSourceGenerator\Demo\TelescopeSourceGeneratorDemo\dotnetCampus.Telescope.SourceGeneratorAnalyzers.Demo.csproj" (default target) (7:6) ->
       (CoreCompile target) -> 
         D:\a\SourceFusion\SourceFusion\src\TelescopeSourceGenerator\Demo\TelescopeSourceGeneratorDemo\Program.cs(23,87): error CS8795: Partial method 'Program.ExportFooEnumerable()' must have an implementation part because it has accessibility modifiers. [D:\a\SourceFusion\SourceFusion\src\TelescopeSourceGenerator\Demo\TelescopeSourceGeneratorDemo\dotnetCampus.Telescope.SourceGeneratorAnalyzers.Demo.csproj]
         D:\a\SourceFusion\SourceFusion\src\TelescopeSourceGenerator\Demo\TelescopeSourceGeneratorDemo\Program.cs(26,64): error CS8795: Partial method 'Program.ExportF1Enumerable()' must have an implementation part because it has accessibility modifiers. [D:\a\SourceFusion\SourceFusion\src\TelescopeSourceGenerator\Demo\TelescopeSourceGeneratorDemo\dotnetCampus.Telescope.SourceGeneratorAnalyzers.Demo.csproj]
         D:\a\SourceFusion\SourceFusion\src\TelescopeSourceGenerator\Demo\TelescopeSourceGeneratorDemo\Program.cs(22,29): error CS0234: The type or namespace name 'TelescopeExportAttributeAttribute' does not exist in the namespace 'dotnetCampus.Telescope' (are you missing an assembly reference?) [D:\a\SourceFusion\SourceFusion\src\TelescopeSourceGenerator\Demo\TelescopeSourceGeneratorDemo\dotnetCampus.Telescope.SourceGeneratorAnalyzers.Demo.csproj]
         D:\a\SourceFusion\SourceFusion\src\TelescopeSourceGenerator\Demo\TelescopeSourceGeneratorDemo\Program.cs(22,29): error CS0234: The type or namespace name 'TelescopeExportAttribute' does not exist in the namespace 'dotnetCampus.Telescope' (are you missing an assembly reference?) [D:\a\SourceFusion\SourceFusion\src\TelescopeSourceGenerator\Demo\TelescopeSourceGeneratorDemo\dotnetCampus.Telescope.SourceGeneratorAnalyzers.Demo.csproj]
         D:\a\SourceFusion\SourceFusion\src\TelescopeSourceGenerator\Demo\TelescopeSourceGeneratorDemo\Program.cs(22,54): error CS0246: The type or namespace name 'IncludeReferences' could not be found (are you missing a using directive or an assembly reference?) [D:\a\SourceFusion\SourceFusion\src\TelescopeSourceGenerator\Demo\TelescopeSourceGeneratorDemo\dotnetCampus.Telescope.SourceGeneratorAnalyzers.Demo.csproj]
         D:\a\SourceFusion\SourceFusion\src\TelescopeSourceGenerator\Demo\TelescopeSourceGeneratorDemo\Program.cs(25,29): error CS0234: The type or namespace name 'TelescopeExportAttributeAttribute' does not exist in the namespace 'dotnetCampus.Telescope' (are you missing an assembly reference?) [D:\a\SourceFusion\SourceFusion\src\TelescopeSourceGenerator\Demo\TelescopeSourceGeneratorDemo\dotnetCampus.Telescope.SourceGeneratorAnalyzers.Demo.csproj]
         D:\a\SourceFusion\SourceFusion\src\TelescopeSourceGenerator\Demo\TelescopeSourceGeneratorDemo\Program.cs(25,29): error CS0234: The type or namespace name 'TelescopeExportAttribute' does not exist in the namespace 'dotnetCampus.Telescope' (are you missing an assembly reference?) [D:\a\SourceFusion\SourceFusion\src\TelescopeSourceGenerator\Demo\TelescopeSourceGeneratorDemo\dotnetCampus.Telescope.SourceGeneratorAnalyzers.Demo.csproj]
         D:\a\SourceFusion\SourceFusion\src\TelescopeSourceGenerator\Demo\TelescopeSourceGeneratorDemo\Program.cs(25,54): error CS0246: The type or namespace name 'IncludeReferences' could not be found (are you missing a using directive or an assembly reference?) [D:\a\SourceFusion\SourceFusion\src\TelescopeSourceGenerator\Demo\TelescopeSourceGeneratorDemo\dotnetCampus.Telescope.SourceGeneratorAnalyzers.Demo.csproj]

Copy link
Member

@lindexi lindexi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

构建没通过

@SeWZC SeWZC force-pushed the t/wzc/UpdateCodeAnalysis branch from c20a482 to d63c8bd Compare January 23, 2024 08:09
@lindexi lindexi assigned SeWZC and unassigned walterlv Jan 23, 2024
Directory.Build.props Outdated Show resolved Hide resolved
@lindexi lindexi merged commit a46f667 into master Jan 29, 2024
2 checks passed
@lindexi lindexi deleted the t/wzc/UpdateCodeAnalysis branch January 29, 2024 02:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants