ufcpp-live / UfcppLiveAgenda

@ufcpp live streaming agenda
MIT License
24 stars 2 forks source link

Visual Studio 16.8 Preview 3 / .NET 5.0 RC1 #15

Closed ufcpp closed 4 years ago

ufcpp commented 4 years ago

ついにリリース候補に。

VS の方は「Preview 3」。

Preview 2 からの C# 差分:

あと、Design Meeting Note 1件

Source Generator がらみもちゃんと試しておきたかったものの… Microsoft.CodeAnalysis.Analyzers パッケージを nuget.org 上じゃなくて、

https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json

からでないと取れないバージョンに更新しないと動かなくなってる状態なのでまた今度。

ufcpp-live commented 4 years ago

配信中書き捨てコード1 ReferenceEquals (警告ウェーブ)で警告が出る条件

public static void MInt(int x, int y)
{
    ReferenceEquals(x, y); // 警告あり
}

public static void MValue<T>(T x, T y)
    where T : struct
{
    ReferenceEquals(x, y); // 警告あり
}

public static void MUnconstrained<T>(T x, T y)
{
    ReferenceEquals(x, y); // 警告なし
}
ufcpp-live commented 4 years ago

2 record の ToString の中身の仕様。 PrintMembers メソッドを介してる。

record Point(int X, int Y)
{
    // ToString の挙動をカスタマイズしたければこいつを上書き。
    // Point { 「この中の部分を Append」 }
    protected virtual bool PrintMembers(StringBuilder sb)
    {
        sb.Append("aaa");
        return true;
    }
}
ufcpp-live commented 4 years ago

3 C# 9.0 では直さない(たぶん直してる余裕ない)やつちょこっとあり。

↑直すPR出てそう。 record Derived : Base(0) はダメだけど、record Derived() : Base(0) は 9.0 正式リリースまでにはできるように。


record Base(int X);
record Derived : Base(0); // C# 9.0 時点ではエラーになる仕様

// C# 10.0 待ち…
//record Derived() : Base(0);

// 9.1 はないよなぁ…
// 7 時代、小数点リリースはなかなか大変だった…
//void m(int? x = default) { } // 7.1 のころ、0 扱い(本来は null。今は null)
ufcpp-live commented 4 years ago

4 もちろんリリースまでに治るやつもある。

record Point(int X, int Y);
record Point3D(int Z) : Point(1, 2); // Z のところに「未使用引数」警告
// C# 9.0 正式リリースまでには治る

https://github.com/dotnet/roslyn/issues/47142

ufcpp-live commented 4 years ago

https://youtu.be/VQLtwak8W0U

ufcpp commented 4 years ago
record Base(int X);
record Derived : Base(0); // C# 9.0 時点ではエラーになる仕様

// C# 9.0 正式リリースまでには以下の書き方はできるようになるはず。
//record Derived() : Base(0);