Skip to content

Commit f4e50e2

Browse files
committed
fix: don't nest twice interface additional types
[converter] Fix #79
1 parent 33b858a commit f4e50e2

File tree

4 files changed

+42
-50
lines changed

4 files changed

+42
-50
lines changed

src/Glutinum.Converter/Transform.fs

-2
Original file line numberDiff line numberDiff line change
@@ -1366,8 +1366,6 @@ let rec private transformToFsharp
13661366
function
13671367

13681368
| GlueType.Interface interfaceInfo ->
1369-
let context = context.PushScope(interfaceInfo.Name)
1370-
13711369
FSharpType.Interface(transformInterface context interfaceInfo)
13721370

13731371
| GlueType.Enum enumInfo -> transformEnum enumInfo

tests/specs/references/typeLiteral/argumentsInMethod/nested.fsx

+16-18
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,33 @@ open System
77
[<AllowNullLiteral>]
88
[<Interface>]
99
type Locale =
10-
abstract member hello: config: Locale.Locale.hello.config -> string
10+
abstract member hello: config: Locale.hello.config -> string
1111

1212
module Locale =
1313

14-
module Locale =
14+
module hello =
1515

16-
module hello =
16+
[<Global>]
17+
[<AllowNullLiteral>]
18+
type config
19+
[<ParamObject; Emit("$0")>]
20+
(
21+
verbose: Locale.hello.config.verbose
22+
) =
23+
24+
member val verbose : Locale.hello.config.verbose = nativeOnly with get, set
25+
26+
module config =
1727

1828
[<Global>]
1929
[<AllowNullLiteral>]
20-
type config
30+
type verbose
2131
[<ParamObject; Emit("$0")>]
2232
(
23-
verbose: Locale.Locale.hello.config.verbose
33+
verbose: bool
2434
) =
2535

26-
member val verbose : Locale.Locale.hello.config.verbose = nativeOnly with get, set
27-
28-
module config =
29-
30-
[<Global>]
31-
[<AllowNullLiteral>]
32-
type verbose
33-
[<ParamObject; Emit("$0")>]
34-
(
35-
verbose: bool
36-
) =
37-
38-
member val verbose : bool = nativeOnly with get, set
36+
member val verbose : bool = nativeOnly with get, set
3937

4038
(***)
4139
#r "nuget: Fable.Core"

tests/specs/references/typeLiteral/argumentsInMethod/simple.fsx

+10-12
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,21 @@ open System
77
[<AllowNullLiteral>]
88
[<Interface>]
99
type Locale =
10-
abstract member hello: config: Locale.Locale.hello.config -> string
10+
abstract member hello: config: Locale.hello.config -> string
1111

1212
module Locale =
1313

14-
module Locale =
14+
module hello =
1515

16-
module hello =
16+
[<Global>]
17+
[<AllowNullLiteral>]
18+
type config
19+
[<ParamObject; Emit("$0")>]
20+
(
21+
verbose: bool
22+
) =
1723

18-
[<Global>]
19-
[<AllowNullLiteral>]
20-
type config
21-
[<ParamObject; Emit("$0")>]
22-
(
23-
verbose: bool
24-
) =
25-
26-
member val verbose : bool = nativeOnly with get, set
24+
member val verbose : bool = nativeOnly with get, set
2725

2826
(***)
2927
#r "nuget: Fable.Core"

tests/specs/references/typeLiteral/argumentsInMethod/undefinedTypesAreConvertedToOptionalArguments.fsx

+16-18
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,25 @@ open System
77
[<AllowNullLiteral>]
88
[<Interface>]
99
type Locale =
10-
abstract member hello: config: Locale.Locale.hello.config -> string
10+
abstract member hello: config: Locale.hello.config -> string
1111

1212
module Locale =
1313

14-
module Locale =
15-
16-
module hello =
17-
18-
[<Global>]
19-
[<AllowNullLiteral>]
20-
type config
21-
[<ParamObject; Emit("$0")>]
22-
(
23-
verbose: bool,
24-
?prefix: string,
25-
?suffix: string
26-
) =
27-
28-
member val verbose : bool = nativeOnly with get, set
29-
member val prefix : string option = nativeOnly with get, set
30-
member val suffix : string option = nativeOnly with get, set
14+
module hello =
15+
16+
[<Global>]
17+
[<AllowNullLiteral>]
18+
type config
19+
[<ParamObject; Emit("$0")>]
20+
(
21+
verbose: bool,
22+
?prefix: string,
23+
?suffix: string
24+
) =
25+
26+
member val verbose : bool = nativeOnly with get, set
27+
member val prefix : string option = nativeOnly with get, set
28+
member val suffix : string option = nativeOnly with get, set
3129

3230
(***)
3331
#r "nuget: Fable.Core"

0 commit comments

Comments
 (0)