Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
f72567b
Allow object expression without overrides
edgarfgp Jul 5, 2024
10baa90
release notes
edgarfgp Jul 6, 2024
cdb0f08
Lets try this version
edgarfgp Jul 6, 2024
26334eb
WIP
edgarfgp Jul 29, 2024
6489ae4
release notes
edgarfgp Jul 29, 2024
8022d39
Update tests
edgarfgp Jul 29, 2024
8c4ae6c
more tests
edgarfgp Jul 30, 2024
217e6ff
more tests
edgarfgp Jul 30, 2024
49486ee
LanguageFeature.AllowObjectExpressionWithoutOverrides
edgarfgp Aug 7, 2024
2fabb99
reduce diff
edgarfgp Aug 7, 2024
1397d32
one more test
edgarfgp Aug 8, 2024
2d2b7de
more tests
edgarfgp Aug 9, 2024
0766d36
WIP more tests
edgarfgp Aug 13, 2024
1ae3ff5
fix merge
edgarfgp Aug 13, 2024
4a26619
More tests
edgarfgp Aug 13, 2024
cb9b78e
Fix failing tests
edgarfgp Aug 13, 2024
2233c5f
more tests
edgarfgp Aug 14, 2024
254553b
Merge branch 'main' into allow-object-expression-without-overrides
edgarfgp Aug 14, 2024
746dbc4
Merge branch 'main' into allow-object-expression-without-overrides
edgarfgp Aug 14, 2024
e0116ce
re-structure tests to make easier to review
edgarfgp Aug 15, 2024
79be202
Merge branch 'allow-object-expression-without-overrides' of github.co…
edgarfgp Aug 15, 2024
5d9d4b1
Support non abstract too
edgarfgp Aug 15, 2024
d4fd47d
Merge branch 'main' into allow-object-expression-without-overrides
edgarfgp Aug 15, 2024
c9d8ed4
Merge branch 'main' into allow-object-expression-without-overrides
edgarfgp Aug 16, 2024
1ef6ccc
Merge branch 'main' into allow-object-expression-without-overrides
edgarfgp Aug 19, 2024
5d60025
Merge branch 'main' into allow-object-expression-without-overrides
edgarfgp Aug 19, 2024
17277d1
withLangVersion90
edgarfgp Aug 19, 2024
38cb08d
Merge branch 'allow-object-expression-without-overrides' of github.co…
edgarfgp Aug 19, 2024
78585a2
Merge branch 'main' into allow-object-expression-without-overrides
edgarfgp Aug 19, 2024
155d352
Merge branch 'main' into allow-object-expression-without-overrides
edgarfgp Aug 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
WIP more tests
  • Loading branch information
edgarfgp committed Aug 13, 2024
commit 0766d365fb873e1a0a48c5736438adfb6fa1bb80
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ let foo2 = { new Foo() with member __.ToString() = base.ToString() }
|> shouldSucceed

[<Fact>]
let ``Object expression can not implement an abstract class and interface having no abstract members.`` () =
let ``Object expression can implement an abstract class and interface having no abstract members.`` () =
Fsx """
type IFirst = interface end

Expand Down Expand Up @@ -306,7 +306,7 @@ let foo2 = { new Foo() with member __.ToString() = base.ToString() }
]

[<Fact>]
let ``Object expression can not implement an abstract class having no abstract members. But error when object expression does not implement all abstract members of the abstract class`` () =
let ``Object expression shows error when object expression does not implement all abstract members of the abstract class`` () =
Fsx """
type ISecond =
abstract member M : unit -> unit
Expand All @@ -328,7 +328,7 @@ let res = { new MyClass() }
]

[<Fact>]
let ``Object expression can implement an abstract class having no abstract members. But error when object expression does not implement all abstract members of the abstract class`` () =
let ``Object expression shows error when object expression does not implement all abstract members of the abstract class preview`` () =
Fsx """
type ISecond =
abstract member M : unit -> unit
Expand All @@ -347,6 +347,45 @@ let res = { new MyClass() }
|> withDiagnostics [
(Error 365, Line 11, Col 11, Line 11, Col 28, "No implementation was given for 'abstract MyClass.M: unit -> unit'")
]

[<Fact>]
let ``C# abstract class with protected constructor can not be implemented by F# object expression`` () =

let csharp =
CSharp
"""
namespace CSLib
{
using System;
public abstract class Animal
{
protected Animal()
{
Console.WriteLine("Animal is created");
}
}
}
"""
|> withName "CSLib"

let fsharp =
FSharp
"""
module FSLib
open CSLib

let res = { new Animal() }
"""
|> withLangVersion80
|> withName "FSLib"
|> withReferences [ csharp ]

fsharp
|> compile
|> shouldFail
|> withDiagnostics [
// Error missing
]

[<Fact>]
let ``C# abstract class with protected constructor can be implemented by F# object expression lang version preview`` () =
Expand Down Expand Up @@ -463,6 +502,7 @@ let res = { new Animal() }
|> compile
|> shouldFail
|> withDiagnostics [
// Error missing
(Error 365, Line 5, Col 11, Line 5, Col 27, "No implementation was given for 'Animal.M() : unit'")
]

Expand Down