Skip to content

Test plan for "using aliases for any types" #56323

@jcouv

Description

@jcouv

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 RegularNext or CSharpNext)
  • 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 unsafe or unsafe using? LDM decision 2/1/2023. using unsafe. This keeps all the using forms consistent that they start with using (or global 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?; where Y is another alias) (AliasUsingNullableReferenceType)
  • unsafe requires proper compilation flag
  • using unsafe in a non-alias using (see UsingUnsafeNonAlias)
  • global alias (with and without unsafe) (see GlobalAliasToType...)
  • duplicate alias (ERR_DuplicateAlias)
  • semantic model: GetTypeInfo on 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 a dynamic type already exists. AliasUsingDirectiveDynamic4 and AliasUsingDirectiveDynamic4.
  • using unsafe X = int; then use X in 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 type X). 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 unsafe on using static? (using static C<int*[]>; is already legal, warning wave?)

Productivity

  • Completion
  • Completion on dynamic
  • Classification
  • QuickInfo
  • Formatting
  • Rename tracking

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions