Skip to content

Commit

Permalink
feat: add ref readonly test (#9432)
Browse files Browse the repository at this point in the history
* feat: add ref readonly test

* test(snapshot): update snapshots 5fac416 for ubuntu-latest

* test(snapshot): update snapshots 5fac416 for windows-latest

---------

Co-authored-by: yufeih <yufeih@users.noreply.github.com>
  • Loading branch information
yufeih and yufeih authored Nov 16, 2023
1 parent c2a3a77 commit 1b3da88
Show file tree
Hide file tree
Showing 19 changed files with 1,978 additions and 426 deletions.
12 changes: 10 additions & 2 deletions samples/csharp/src/CSharp12.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,12 @@ public void Withdrawal(decimal amount)

public class CollectionExpressions
{
public static int[] a = [1, 2, 3, 4, 5, 6, 7, 8];
static CollectionExpressions()
{
Span<int> b = ['a', 'b', 'c', 'd', 'e', 'f', 'h', 'i'];
}

public static Span<int> b => ['a', 'b', 'c', 'd', 'e', 'f', 'h', 'i'];
public static int[] a = [1, 2, 3, 4, 5, 6, 7, 8];

public static int[][] twoD = [[1, 2, 3], [4, 5, 6], [7, 8, 9]];
}
Expand All @@ -76,3 +79,8 @@ public struct InlineArrays
{
private int _element0;
}

public class RefReadOnlyParameters
{
public void Foo(ref readonly int bar) { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
},
"id": "a",
"path": "src/CSharp12.cs",
"startLine": 52.0,
"startLine": 57.0,
"endLine": 0.0
},
"assemblies": [
Expand All @@ -179,7 +179,7 @@
"summary": "",
"platform": null,
"docurl": "https://github.com/dotnet/docfx/new/main/apiSpec/new?filename=CSharp12_CollectionExpressions_a.md&value=---%0Auid%3A%20CSharp12.CollectionExpressions.a%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A",
"sourceurl": "https://github.com/dotnet/docfx/blob/main/samples/csharp/src/CSharp12.cs/#L53",
"sourceurl": "https://github.com/dotnet/docfx/blob/main/samples/csharp/src/CSharp12.cs/#L58",
"remarks": "",
"conceptual": "",
"implements": "",
Expand Down Expand Up @@ -301,7 +301,7 @@
},
"id": "twoD",
"path": "src/CSharp12.cs",
"startLine": 56.0,
"startLine": 59.0,
"endLine": 0.0
},
"assemblies": [
Expand All @@ -313,7 +313,7 @@
"summary": "",
"platform": null,
"docurl": "https://github.com/dotnet/docfx/new/main/apiSpec/new?filename=CSharp12_CollectionExpressions_twoD.md&value=---%0Auid%3A%20CSharp12.CollectionExpressions.twoD%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A",
"sourceurl": "https://github.com/dotnet/docfx/blob/main/samples/csharp/src/CSharp12.cs/#L57",
"sourceurl": "https://github.com/dotnet/docfx/blob/main/samples/csharp/src/CSharp12.cs/#L60",
"remarks": "",
"conceptual": "",
"implements": "",
Expand All @@ -324,193 +324,6 @@
"hideSubtitle": false
}
]
},
{
"inProperty": true,
"typePropertyName": "inProperty",
"id": "properties",
"children": [
{
"uid": "CSharp12.CollectionExpressions.b",
"isEii": false,
"isExtensionMethod": false,
"parent": "CSharp12.CollectionExpressions",
"isExternal": false,
"name": [
{
"lang": "csharp",
"value": "b"
},
{
"lang": "vb",
"value": "b"
}
],
"nameWithType": [
{
"lang": "csharp",
"value": "CollectionExpressions.b"
},
{
"lang": "vb",
"value": "CollectionExpressions.b"
}
],
"fullName": [
{
"lang": "csharp",
"value": "CSharp12.CollectionExpressions.b"
},
{
"lang": "vb",
"value": "CSharp12.CollectionExpressions.b"
}
],
"specName": [
{
"lang": "csharp",
"value": "<xref uid=\"CSharp12.CollectionExpressions.b\" text=\"b\"/>"
},
{
"lang": "vb",
"value": "<xref uid=\"CSharp12.CollectionExpressions.b\" text=\"b\"/>"
}
],
"syntax": {
"content": [
{
"lang": "csharp",
"value": "public static Span<int> b { get; }"
},
{
"lang": "vb",
"value": "Public Shared ReadOnly Property b As Span(Of Integer)"
}
],
"parameters": [],
"return": null,
"propertyValue": {
"type": {
"uid": "System.Span{System.Int32}",
"definition": "System.Span`1",
"name": [
{
"lang": "csharp",
"value": "Span<int>"
},
{
"lang": "vb",
"value": "Span(Of Integer)"
}
],
"nameWithType": [
{
"lang": "csharp",
"value": "Span<int>"
},
{
"lang": "vb",
"value": "Span(Of Integer)"
}
],
"fullName": [
{
"lang": "csharp",
"value": "System.Span<int>"
},
{
"lang": "vb",
"value": "System.Span(Of Integer)"
}
],
"specName": [
{
"lang": "csharp",
"value": "<a class=\"xref\" href=\"https://learn.microsoft.com/dotnet/api/system.span-1\">Span</a>&lt;<a class=\"xref\" href=\"https://learn.microsoft.com/dotnet/api/system.int32\">int</a>&gt;"
},
{
"lang": "vb",
"value": "<a class=\"xref\" href=\"https://learn.microsoft.com/dotnet/api/system.span-1\">Span</a>(Of <a class=\"xref\" href=\"https://learn.microsoft.com/dotnet/api/system.int32\">Integer</a>)"
}
]
}
}
},
"source": {
"remote": {
"path": "samples/csharp/src/CSharp12.cs",
"branch": "main",
"repo": "https://github.com/dotnet/docfx"
},
"id": "b",
"path": "src/CSharp12.cs",
"startLine": 54.0,
"endLine": 0.0
},
"assemblies": [
"CSharp"
],
"namespace": "CSharp12",
"overload": {
"uid": "CSharp12.CollectionExpressions.b*",
"name": [
{
"lang": "csharp",
"value": "b"
},
{
"lang": "vb",
"value": "b"
}
],
"nameWithType": [
{
"lang": "csharp",
"value": "CollectionExpressions.b"
},
{
"lang": "vb",
"value": "CollectionExpressions.b"
}
],
"fullName": [
{
"lang": "csharp",
"value": "CSharp12.CollectionExpressions.b"
},
{
"lang": "vb",
"value": "CSharp12.CollectionExpressions.b"
}
],
"specName": [
{
"lang": "csharp",
"value": "<xref uid=\"CSharp12.CollectionExpressions.b*\" text=\"b\"/>"
},
{
"lang": "vb",
"value": "<xref uid=\"CSharp12.CollectionExpressions.b*\" text=\"b\"/>"
}
],
"id": "CSharp12_CollectionExpressions_b_"
},
"level": 0.0,
"type": "property",
"summary": "",
"platform": null,
"docurl": "https://github.com/dotnet/docfx/new/main/apiSpec/new?filename=CSharp12_CollectionExpressions_b.md&value=---%0Auid%3A%20CSharp12.CollectionExpressions.b%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A",
"sourceurl": "https://github.com/dotnet/docfx/blob/main/samples/csharp/src/CSharp12.cs/#L55",
"remarks": "",
"conceptual": "",
"implements": "",
"example": "",
"seealso": null,
"id": "CSharp12_CollectionExpressions_b",
"hideTitleType": false,
"hideSubtitle": false
}
]
}
],
"langs": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
},
"id": "Foo",
"path": "src/CSharp12.cs",
"startLine": 61.0,
"startLine": 64.0,
"endLine": 0.0
},
"assemblies": [
Expand Down Expand Up @@ -177,7 +177,7 @@
"summary": "",
"platform": null,
"docurl": "https://github.com/dotnet/docfx/new/main/apiSpec/new?filename=CSharp12_DefaultLambdaParameters_Foo.md&value=---%0Auid%3A%20CSharp12.DefaultLambdaParameters.Foo%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A",
"sourceurl": "https://github.com/dotnet/docfx/blob/main/samples/csharp/src/CSharp12.cs/#L62",
"sourceurl": "https://github.com/dotnet/docfx/blob/main/samples/csharp/src/CSharp12.cs/#L65",
"remarks": "",
"conceptual": "",
"implements": "",
Expand Down Expand Up @@ -233,7 +233,7 @@
},
"id": "DefaultLambdaParameters",
"path": "src/CSharp12.cs",
"startLine": 59.0,
"startLine": 62.0,
"endLine": 0.0
},
"assemblies": [
Expand Down Expand Up @@ -814,7 +814,7 @@
},
"yamlmime": "ManagedReference",
"docurl": "https://github.com/dotnet/docfx/new/main/apiSpec/new?filename=CSharp12_DefaultLambdaParameters.md&value=---%0Auid%3A%20CSharp12.DefaultLambdaParameters%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A",
"sourceurl": "https://github.com/dotnet/docfx/blob/main/samples/csharp/src/CSharp12.cs/#L60",
"sourceurl": "https://github.com/dotnet/docfx/blob/main/samples/csharp/src/CSharp12.cs/#L63",
"summary": "",
"remarks": "",
"conceptual": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
},
"id": "InlineArrays",
"path": "src/CSharp12.cs",
"startLine": 73.0,
"startLine": 76.0,
"endLine": 0.0
},
"assemblies": [
Expand Down Expand Up @@ -573,7 +573,7 @@
},
"yamlmime": "ManagedReference",
"docurl": "https://github.com/dotnet/docfx/new/main/apiSpec/new?filename=CSharp12_InlineArrays.md&value=---%0Auid%3A%20CSharp12.InlineArrays%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A",
"sourceurl": "https://github.com/dotnet/docfx/blob/main/samples/csharp/src/CSharp12.cs/#L74",
"sourceurl": "https://github.com/dotnet/docfx/blob/main/samples/csharp/src/CSharp12.cs/#L77",
"summary": "",
"remarks": "",
"conceptual": "",
Expand Down
Loading

0 comments on commit 1b3da88

Please sign in to comment.