-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor-open: add a test for functor application paths
- Loading branch information
Showing
2 changed files
with
186 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
FIXME: functor applications in type paths are not handled | ||
|
||
Unqualifying inside application paths: | ||
|
||
$ $MERLIN single refactor-open -action unqualify -position 26:10 \ | ||
> -filename test.ml < test.ml | ||
{ | ||
"class": "return", | ||
"value": [ | ||
{ | ||
"start": { | ||
"line": 28, | ||
"col": 44 | ||
}, | ||
"end": { | ||
"line": 28, | ||
"col": 53 | ||
}, | ||
"content": "C" | ||
}, | ||
{ | ||
"start": { | ||
"line": 29, | ||
"col": 12 | ||
}, | ||
"end": { | ||
"line": 29, | ||
"col": 24 | ||
}, | ||
"content": "Make" | ||
}, | ||
{ | ||
"start": { | ||
"line": 29, | ||
"col": 26 | ||
}, | ||
"end": { | ||
"line": 29, | ||
"col": 35 | ||
}, | ||
"content": "C" | ||
}, | ||
{ | ||
"start": { | ||
"line": 31, | ||
"col": 12 | ||
}, | ||
"end": { | ||
"line": 31, | ||
"col": 24 | ||
}, | ||
"content": "Make" | ||
}, | ||
{ | ||
"start": { | ||
"line": 36, | ||
"col": 19 | ||
}, | ||
"end": { | ||
"line": 36, | ||
"col": 28 | ||
}, | ||
"content": "C" | ||
}, | ||
{ | ||
"start": { | ||
"line": 37, | ||
"col": 13 | ||
}, | ||
"end": { | ||
"line": 37, | ||
"col": 25 | ||
}, | ||
"content": "Make" | ||
} | ||
], | ||
"notifications": [] | ||
} | ||
|
||
Qualifying inside application paths: | ||
|
||
$ $MERLIN single refactor-open -action qualify -position 26:10 \ | ||
> -filename test.ml < test.ml | ||
{ | ||
"class": "return", | ||
"value": [ | ||
{ | ||
"start": { | ||
"line": 33, | ||
"col": 13 | ||
}, | ||
"end": { | ||
"line": 33, | ||
"col": 17 | ||
}, | ||
"content": "Wrapper.Make" | ||
}, | ||
{ | ||
"start": { | ||
"line": 33, | ||
"col": 19 | ||
}, | ||
"end": { | ||
"line": 33, | ||
"col": 20 | ||
}, | ||
"content": "Wrapper.C" | ||
}, | ||
{ | ||
"start": { | ||
"line": 34, | ||
"col": 13 | ||
}, | ||
"end": { | ||
"line": 34, | ||
"col": 17 | ||
}, | ||
"content": "Wrapper.Make" | ||
}, | ||
{ | ||
"start": { | ||
"line": 36, | ||
"col": 13 | ||
}, | ||
"end": { | ||
"line": 36, | ||
"col": 17 | ||
}, | ||
"content": "Wrapper.Make" | ||
}, | ||
{ | ||
"start": { | ||
"line": 37, | ||
"col": 27 | ||
}, | ||
"end": { | ||
"line": 37, | ||
"col": 28 | ||
}, | ||
"content": "Wrapper.C" | ||
} | ||
], | ||
"notifications": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
module Wrapper = struct | ||
module type S = sig | ||
type t | ||
val x : t | ||
end | ||
|
||
module Make (X : S) = struct | ||
include X | ||
|
||
let () = ignore x | ||
end | ||
|
||
module C = struct | ||
type t = char | ||
let x = 'a' | ||
end | ||
end | ||
|
||
module I = struct | ||
type t = int | ||
let x = 42 | ||
end | ||
|
||
module Hammer = Wrapper | ||
|
||
open Wrapper | ||
|
||
module MC = Hammer (* just because *).Make (Wrapper.C) | ||
module MD = Wrapper.Make (Wrapper.C) | ||
|
||
module MI = Wrapper.Make (I) | ||
|
||
module MC2 = Make (C) | ||
module MI2 = Make (I) | ||
|
||
module MC3 = Make (Wrapper.C) | ||
module MC4 = Wrapper.Make (C) | ||
|
||
type t1 = Wrapper.Make(Wrapper.C).t | ||
type t2 = Make(Wrapper.C).t | ||
type t3 = Wrapper.Make(C).t | ||
type t4 = Make(C).t |