Skip to content

Commit

Permalink
test: show issues with deduplication
Browse files Browse the repository at this point in the history
  • Loading branch information
voodoos committed Nov 20, 2024
1 parent a36f42a commit 4eb18cc
Showing 1 changed file with 240 additions and 0 deletions.
240 changes: 240 additions & 0 deletions tests/test-dirs/type-enclosing/generic-types.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,240 @@
$ cat >main.ml <<'EOF'
> let _ = List.map Fun.id [3]
> EOF

With index 0 only the first type is shown:
$ $MERLIN single type-enclosing -position 1:14 -index 0 \
> -filename ./main.ml < ./main.ml | jq '.value[0,1]'
{
"start": {
"line": 1,
"col": 8
},
"end": {
"line": 1,
"col": 16
},
"type": "('a -> 'b) -> 'a list -> 'b list",
"tail": "no"
}
{
"start": {
"line": 1,
"col": 8
},
"end": {
"line": 1,
"col": 16
},
"type": 1,
"tail": "no"
}

With index 1 only the second is shown (the first is a string so it is always shown):
$ $MERLIN single type-enclosing -position 1:14 -index 1 \
> -filename ./main.ml < ./main.ml | jq '.value[0,1]'
{
"start": {
"line": 1,
"col": 8
},
"end": {
"line": 1,
"col": 16
},
"type": "('a -> 'b) -> 'a list -> 'b list",
"tail": "no"
}
{
"start": {
"line": 1,
"col": 8
},
"end": {
"line": 1,
"col": 16
},
"type": "(int -> int) -> int list -> int list",
"tail": "no"
}


With index 0 only the first type is shown:
$ $MERLIN single type-enclosing -position 1:10 -index 0 \
> -filename ./main.ml < ./main.ml
{
"class": "return",
"value": [
{
"start": {
"line": 1,
"col": 8
},
"end": {
"line": 1,
"col": 12
},
"type": "(module Stdlib__List)",
"tail": "no"
},
{
"start": {
"line": 1,
"col": 8
},
"end": {
"line": 1,
"col": 16
},
"type": 1,
"tail": "no"
},
{
"start": {
"line": 1,
"col": 8
},
"end": {
"line": 1,
"col": 27
},
"type": 2,
"tail": "no"
}
],
"notifications": []
}

With index 1 only the second is shown (the first is a string so it is always shown):
FIXME? We don't see the generic version
$ $MERLIN single type-enclosing -position 1:10 -index 1 \
> -filename ./main.ml < ./main.ml
{
"class": "return",
"value": [
{
"start": {
"line": 1,
"col": 8
},
"end": {
"line": 1,
"col": 12
},
"type": "(module Stdlib__List)",
"tail": "no"
},
{
"start": {
"line": 1,
"col": 8
},
"end": {
"line": 1,
"col": 16
},
"type": "(int -> int) -> int list -> int list",
"tail": "no"
},
{
"start": {
"line": 1,
"col": 8
},
"end": {
"line": 1,
"col": 27
},
"type": 2,
"tail": "no"
}
],
"notifications": []
}

$ cat >main.ml <<'EOF'
> module List = struct let map : (int -> int) -> int list -> int list = List.map end
> let _ = List.map Fun.id [3]
> EOF

FIXME With index 0 only the first type is shown but deduplication failed becauser the
next type was not rendered.
$ $MERLIN single type-enclosing -position 2:14 -index 0 \
> -filename ./main.ml < ./main.ml
{
"class": "return",
"value": [
{
"start": {
"line": 2,
"col": 8
},
"end": {
"line": 2,
"col": 16
},
"type": "(int -> int) -> int list -> int list",
"tail": "no"
},
{
"start": {
"line": 2,
"col": 8
},
"end": {
"line": 2,
"col": 16
},
"type": 1,
"tail": "no"
},
{
"start": {
"line": 2,
"col": 8
},
"end": {
"line": 2,
"col": 27
},
"type": 2,
"tail": "no"
}
],
"notifications": []
}

FIXME With index 1 the list is shorter and the numbering is wrong ! In fact, it
should have been shorter earlier.
$ $MERLIN single type-enclosing -position 2:14 -index 1 \
> -filename ./main.ml < ./main.ml
{
"class": "return",
"value": [
{
"start": {
"line": 2,
"col": 8
},
"end": {
"line": 2,
"col": 16
},
"type": "(int -> int) -> int list -> int list",
"tail": "no"
},
{
"start": {
"line": 2,
"col": 8
},
"end": {
"line": 2,
"col": 27
},
"type": 2,
"tail": "no"
}
],
"notifications": []
}

0 comments on commit 4eb18cc

Please sign in to comment.