roslyn icon indicating copy to clipboard operation
roslyn copied to clipboard

Emit and report missing `Decimal-` and `DateTimeConstantAttribute`

Open jjonescz opened this issue 2 years ago • 2 comments

Fixes #65728.

  • Emits those attributes for synthesized delegates and closure implementation methods.
  • Reports if those attribute types are missing (instead of crashing on Debug.Assert during emit) for synthesized delegates, methods, local functions, lambdas, and fields.

Relates to lambda default parameters.

jjonescz avatar Dec 05 '22 15:12 jjonescz

Done with review pass (commit 2)

AlekseyTs avatar Dec 06 '22 16:12 AlekseyTs

Done with review pass (commit 14)

AlekseyTs avatar Dec 13 '22 20:12 AlekseyTs

            // check that the corresponding `*ConstantAttribute` is available.

It is not clear to me why this check was relevant here and isn't relevant any more. It feels to me that checking for System_ParamArrayAttribute__ctor and for these attributes should always come together.


In reply to: 1353581343


In reply to: 1353581343


Refers to: src/Compilers/CSharp/Portable/Binder/Semantics/Conversions/Conversions.cs:72 in ebf1101. [](commit_id = ebf11012711cc15756843eb014d271b6ba52b971, deletion_comment = True)

AlekseyTs avatar Dec 15 '22 19:12 AlekseyTs

Done with review pass (commit 40)

AlekseyTs avatar Dec 18 '22 20:12 AlekseyTs

Done with review pass (commit 46)

AlekseyTs avatar Dec 19 '22 16:12 AlekseyTs

            if (isSynthesized && defaultValue != ConstantValue.NotAvailable &&

Dropped the != ConstantValue.NotAvailable check. Doesn't look intentional. #Closed


Refers to: src/Compilers/CSharp/Portable/Binder/Binder_Conversions.cs:793 in 589ff29. [](commit_id = 589ff29cd98b87c45a20c28eb312477125886c02, deletion_comment = True)

AlekseyTs avatar Dec 19 '22 18:12 AlekseyTs

            if (isSynthesized && defaultValue != ConstantValue.NotAvailable &&

I see, that was equivalent to the null check


In reply to: 1358063599


Refers to: src/Compilers/CSharp/Portable/Binder/Binder_Conversions.cs:793 in 589ff29. [](commit_id = 589ff29cd98b87c45a20c28eb312477125886c02, deletion_comment = True)

AlekseyTs avatar Dec 19 '22 18:12 AlekseyTs

@dotnet/roslyn-compiler for the second review

jjonescz avatar Dec 19 '22 18:12 jjonescz