-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Description
Championed proposal: dotnet/csharplang#4284
Speclet: https://github.com/dotnet/csharplang/blob/main/proposals/csharp-12.0/using-alias-types.md
Note this doesn't include support for generic aliases (draft spec dotnet/csharplang#4452)
Compiler
- LangVer (tests with
RegularNextorCSharpNext) - spec: https://github.com/dotnet/csharplang/blob/main/proposals/using-alias-types.md
- Consider documenting rule that unsafe aliases are also checked at usage point
- LDM:
using unsafeorunsafe using? LDM decision 2/1/2023.using unsafe. This keeps all theusingforms consistent that they start withusing(orglobal using). - Various types:
- tuples (need positive test)
- built-in types:
int,nint, ... - array types
- pointer and function pointer
- ref type (
StaticUsingDirectiveRefType) - dynamic
- nullable reference types (disallowed:
using X = object?;,using X = Y?;whereYis another alias) (AliasUsingNullableReferenceType)
- unsafe requires proper compilation flag
- using
unsafein a non-alias using (seeUsingUnsafeNonAlias) - global alias (with and without
unsafe) (seeGlobalAliasToType...) - duplicate alias (ERR_DuplicateAlias)
- semantic model:
GetTypeInfoon the RHS,IAliasSymbol.Target,GetAliasInfo - SyntaxNormalizer (
using unsafe x = ...,using x = (one, two);, ...) - Obsolete:
using X = (ObsoleteType, ObsoleteType);,using X = ObsoleteType[]; - EnC: Yes. Needs tests. See TopLevelEditingTests.Using_Global_Insert
-
using T = dynamic;where adynamictype already exists. AliasUsingDirectiveDynamic4 and AliasUsingDirectiveDynamic4. -
using unsafe X = int;then useXin safe context (no diagnostic). TestUnsafeAlias14_A, TestUnsafeAlias14_B -
using X = scoped R;. TestScopedType1-4 -
using X = ref readonly R;AliasUsingDirectiveRefReadonlyType -
using X = __makeref(...);. TestMakeRef -
using X = __arglist();. TestArgList - review public API changes. Done: API proposal for "Using Alias to any Type" #66913
- inspect the syntactic pointer type detection logic in compiler (is there a circularity issue?). Have made the change to no longer do things syntactically. Added tests to ensure no issue (TestStructWithReferenceToItselfThroughAliasPointer1/2). But need eyes on this.
- debugger support (
using X = dynamic;inspect a value of typeX). Added in Update PDB behavior for 'using alias to type', and add EE and PDB tests. #67105 - add an EE test. Added in Update PDB behavior for 'using alias to type', and add EE and PDB tests. #67105.
- LDM: should we allow
unsafeonusing static? (using static C<int*[]>;is already legal, warning wave?)
Productivity
- Completion
- Completion on
dynamic - Classification
- QuickInfo
- Formatting
- Rename tracking
rolfbjarne and agockeagocke