nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: goccy/go-yaml
Pull request #335 (2022-12-19 05:26:32)

Fix behavior when struct fields conflicted
fix https://github.com/goccy/go-yaml/issues/332

codecov-commenter: # [Codecov](https://codecov.io/gh/goccy/go-yaml/pull/335?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Masaaki+Goshima) Report
> Merging [#335](https://codecov.io/gh/goccy/go-yaml/pull/335?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Masaaki+Goshima) (330ba01) into [master](https://codecov.io/gh/goccy/go-yaml/commit/45bdea2a2718d7146892feebcbefb749a5c57421?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Masaaki+Goshima) (45bdea2) will **increase** coverage by `0.01%`.
> The diff coverage is `100.00%`.

<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##           master     #335      +/-   ##
==========================================
+ Coverage   75.63%   75.65%   +0.01%     
==========================================
  Files          13       13              
  Lines        4359     4362       +3     
==========================================
+ Hits         3297     3300       +3     
  Misses        819      819              
  Partials      243      243              
```

</details>

Patch:
diff --git a/struct.go b/struct.go
index ac78f31..a3da8dd 100644
--- a/struct.go
+++ b/struct.go
@@ -95,7 +95,7 @@ type StructFieldMap map[string]*StructField
 
 func (m StructFieldMap) isIncludedRenderName(name string) bool {
 	for _, v := range m {
-		if v.RenderName == name {
+		if !v.IsInline && v.RenderName == name {
 			return true
 		}
 	}


Test patch:
diff --git a/decode_test.go b/decode_test.go
index e470e64..3938097 100644
--- a/decode_test.go
+++ b/decode_test.go
@@ -2804,3 +2804,21 @@ steps:
 		})
 	}
 }
+
+func TestSameNameInineStruct(t *testing.T) {
+	type X struct {
+		X float64 `yaml:"x"`
+	}
+
+	type T struct {
+		X `yaml:",inline"`
+	}
+
+	var v T
+	if err := yaml.Unmarshal([]byte(`x: 0.7`), &v); err != nil {
+		t.Fatal(err)
+	}
+	if fmt.Sprint(v.X.X) != "0.7" {
+		t.Fatalf("failed to decode")
+	}
+}
Repository: goccy/go-yaml
Pull request #372 (2023-05-07 03:41:30)

Handle `\r` in a double-quoted string the same as `\n`
Fix https://github.com/goccy/go-yaml/issues/371

If https://github.com/goccy/go-yaml/issues/371 is not the intended behavior, please consider merging this PR.

codecov-commenter: ## [Codecov](https://app.codecov.io/gh/goccy/go-yaml/pull/372?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Masaaki+Goshima) Report
> Merging [#372](https://app.codecov.io/gh/goccy/go-yaml/pull/372?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Masaaki+Goshima) (c775671) into [master](https://app.codecov.io/gh/goccy/go-yaml/commit/1bbf205584ed1ff19a37ea6b417aad8542979ed0?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Masaaki+Goshima) (1bbf205) will **not change** coverage.
> The diff coverage is `n/a`.

:mega: This organization is not using Codecov’s [GitHub App Integration](https://github.com/apps/codecov). We recommend you install it so Codecov can continue to function properly for your repositories. [Learn more](https://about.codecov.io/blog/codecov-is-updating-its-github-integration/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Masaaki+Goshima)

<details><summary>Additional details and impacted files</summary>


```diff
@@           Coverage Diff           @@
##           master     #372   +/-   ##
=======================================
  Coverage   75.61%   75.61%           
=======================================
  Files          13       13           
  Lines        4650     4650           
=======================================
  Hits         3516     3516           
  Misses        874      874           
  Partials      260      260           
```

</details>

Patch:
diff --git a/scanner/scanner.go b/scanner/scanner.go
index ce9c665..b0eac48 100644
--- a/scanner/scanner.go
+++ b/scanner/scanner.go
@@ -339,6 +339,11 @@ func (s *Scanner) scanDoubleQuote(ctx *Context) (tk *token.Token, pos int) {
 					value = append(value, '\n')
 					idx++
 					continue
+				case 'r':
+					ctx.addOriginBuf(nextChar)
+					value = append(value, '\r')
+					idx++
+					continue
 				case 'v':
 					ctx.addOriginBuf(nextChar)
 					value = append(value, '\v')


Test patch:
diff --git a/decode_test.go b/decode_test.go
index 2549bea..0ac4a7f 100644
--- a/decode_test.go
+++ b/decode_test.go
@@ -425,6 +425,14 @@ func TestDecoder(t *testing.T) {
 			`"1": "a\x2Fb\u002Fc\U0000002Fd"`,
 			map[interface{}]interface{}{"1": `a/b/c/d`},
 		},
+		{
+			"'1': \"2\\n3\"",
+			map[interface{}]interface{}{"1": "2\n3"},
+		},
+		{
+			"'1': \"2\\r\\n3\"",
+			map[interface{}]interface{}{"1": "2\r\n3"},
+		},
 
 		{
 			"a: -b_c",
Repository: goccy/go-yaml
Pull request #386 (2023-09-13 08:03:38)

fix: skip encoding an inline field if it is null
The current implementation returns an error if an inline field is null. This PR makes skipping encoding null inline fields.

This behavior is the same as `encoding/json`.

```go
b, err := json.Marshal(struct {
	*base `yaml:",inline"`
	C     bool
}{
	C: true,
})
if err != nil {
	panic(err)
}
fmt.Println(string(b))
```
=> `{"C":true}`

codecov-commenter: ## [Codecov](https://app.codecov.io/gh/goccy/go-yaml/pull/386?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Masaaki+Goshima) Report
> Merging [#386](https://app.codecov.io/gh/goccy/go-yaml/pull/386?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Masaaki+Goshima) (d90e6f3) into [master](https://app.codecov.io/gh/goccy/go-yaml/commit/42fb764e96842b555177d841eb3a98cf09e36f7a?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Masaaki+Goshima) (42fb764) will **increase** coverage by `0.05%`.
> The diff coverage is `100.00%`.

:exclamation: Your organization needs to install the [Codecov GitHub app](https://github.com/apps/codecov/installations/select_target) to enable full functionality.

<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##           master     #386      +/-   ##
==========================================
+ Coverage   75.61%   75.66%   +0.05%     
==========================================
  Files          13       13              
  Lines        4650     4652       +2     
==========================================
+ Hits         3516     3520       +4     
+ Misses        874      873       -1     
+ Partials      260      259       -1     
```

</details>
goccy: Thank you for your great PR !! LGTM 👍 

Patch:
diff --git a/encode.go b/encode.go
index 7d8d81e..3b9b298 100644
--- a/encode.go
+++ b/encode.go
@@ -823,6 +823,10 @@ func (e *Encoder) encodeStruct(ctx context.Context, value reflect.Value, column
 			}
 			mapNode, ok := value.(ast.MapNode)
 			if !ok {
+				// if an inline field is null, skip encoding it
+				if _, ok := value.(*ast.NullNode); ok {
+					continue
+				}
 				return nil, xerrors.Errorf("inline value is must be map or struct type")
 			}
 			mapIter := mapNode.MapRange()


Test patch:
diff --git a/encode_test.go b/encode_test.go
index 74b1aa5..e872c61 100644
--- a/encode_test.go
+++ b/encode_test.go
@@ -980,6 +980,30 @@ c: true
 	}
 }
 
+func TestEncoder_InlineNil(t *testing.T) {
+	type base struct {
+		A int
+		B string
+	}
+	var buf bytes.Buffer
+	enc := yaml.NewEncoder(&buf)
+	if err := enc.Encode(struct {
+		*base `yaml:",inline"`
+		C     bool
+	}{
+		C: true,
+	}); err != nil {
+		t.Fatalf("%+v", err)
+	}
+	expect := `
+c: true
+`
+	actual := "\n" + buf.String()
+	if expect != actual {
+		t.Fatalf("inline marshal error: expect=[%s] actual=[%s]", expect, actual)
+	}
+}
+
 func TestEncoder_Flow(t *testing.T) {
 	var buf bytes.Buffer
 	enc := yaml.NewEncoder(&buf, yaml.Flow(true))
Repository: goccy/go-yaml
Pull request #453 (2024-06-19 08:42:17)

support custom unmarshalling for map keys
Close #452 

Checking if map key supports any unmarshalling interface and using it to decode the key before falling back to getting node value and converting it to key type

- [x] Describe the purpose for which you created this PR.  
- [x] Create test code that corresponds to the modification

goccy: Thank you for your great PR !!! LGTM 👍 

Patch:
diff --git a/decode.go b/decode.go
index 79117ca..b6e22a5 100644
--- a/decode.go
+++ b/decode.go
@@ -15,11 +15,12 @@ import (
 	"strconv"
 	"time"
 
+	"golang.org/x/xerrors"
+
 	"github.com/goccy/go-yaml/ast"
 	"github.com/goccy/go-yaml/internal/errors"
 	"github.com/goccy/go-yaml/parser"
 	"github.com/goccy/go-yaml/token"
-	"golang.org/x/xerrors"
 )
 
 // Decoder reads and decodes YAML values from an input stream.
@@ -1500,10 +1501,19 @@ func (d *Decoder) decodeMap(ctx context.Context, dst reflect.Value, src ast.Node
 			}
 			continue
 		}
-		k := reflect.ValueOf(d.nodeToValue(key))
-		if k.IsValid() && k.Type().ConvertibleTo(keyType) {
-			k = k.Convert(keyType)
+
+		k := d.createDecodableValue(keyType)
+		if d.canDecodeByUnmarshaler(k) {
+			if err := d.decodeByUnmarshaler(ctx, k, key); err != nil {
+				return errors.Wrapf(err, "failed to decode by unmarshaler")
+			}
+		} else {
+			k = reflect.ValueOf(d.nodeToValue(key))
+			if k.IsValid() && k.Type().ConvertibleTo(keyType) {
+				k = k.Convert(keyType)
+			}
 		}
+
 		if k.IsValid() {
 			if err := d.validateDuplicateKey(keyMap, k.Interface(), key); err != nil {
 				return errors.Wrapf(err, "invalid map key")


Test patch:
diff --git a/decode_test.go b/decode_test.go
index cabfd33..7e9b663 100644
--- a/decode_test.go
+++ b/decode_test.go
@@ -14,11 +14,12 @@ import (
 	"testing"
 	"time"
 
+	"golang.org/x/xerrors"
+
 	"github.com/goccy/go-yaml"
 	"github.com/goccy/go-yaml/ast"
 	"github.com/goccy/go-yaml/internal/errors"
 	"github.com/goccy/go-yaml/parser"
-	"golang.org/x/xerrors"
 )
 
 type Child struct {
@@ -2906,3 +2907,29 @@ func TestSameNameInineStruct(t *testing.T) {
 		t.Fatalf("failed to decode")
 	}
 }
+
+type unmarshableMapKey struct {
+	Key string
+}
+
+func (mk *unmarshableMapKey) UnmarshalYAML(b []byte) error {
+	mk.Key = string(b)
+	return nil
+}
+
+func TestMapKeyCustomUnmarshaler(t *testing.T) {
+	var m map[unmarshableMapKey]string
+	if err := yaml.Unmarshal([]byte(`key: value`), &m); err != nil {
+		t.Fatalf("failed to unmarshal %v", err)
+	}
+	if len(m) != 1 {
+		t.Fatalf("expected 1 element in map, but got %d", len(m))
+	}
+	val, ok := m[unmarshableMapKey{Key: "key"}]
+	if !ok {
+		t.Fatal("expected to have element 'key' in map")
+	}
+	if val != "value" {
+		t.Fatalf("expected to have value \"value\", but got %q", val)
+	}
+}
\ No newline at end of file
Repository: goccy/go-yaml
Pull request #520 (2024-11-11 12:34:25)

Fix parsing of invalid map key
fix https://github.com/goccy/go-yaml/issues/223

codecov-commenter: :warning: Please install the !['codecov app svg image'](https://github.com/codecov/engineering-team/assets/152432831/e90313f4-9d3a-4b63-8b54-cfe14e7ec20d) to ensure uploads and comments are reliably processed by Codecov.

## [Codecov](https://app.codecov.io/gh/goccy/go-yaml/pull/520?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Masaaki+Goshima) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 79.10%. Comparing base [(`8f36c1b`)](https://app.codecov.io/gh/goccy/go-yaml/commit/8f36c1b309907ee74cd1dae9319a6ff007c537e6?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Masaaki+Goshima) to head [(`a8d6477`)](https://app.codecov.io/gh/goccy/go-yaml/commit/a8d6477b7ad8250445706b422118de1eef656f4f?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Masaaki+Goshima).

:exclamation: Your organization needs to install the [Codecov GitHub app](https://github.com/apps/codecov/installations/select_target) to enable full functionality.

<details><summary>Additional details and impacted files</summary>


```diff
@@           Coverage Diff           @@
##           master     #520   +/-   ##
=======================================
  Coverage   79.09%   79.10%           
=======================================
  Files          17       17           
  Lines        6110     6112    +2     
=======================================
+ Hits         4833     4835    +2     
  Misses        965      965           
  Partials      312      312           
```

</details>

Patch:
diff --git a/parser/parser.go b/parser/parser.go
index 3684056..846469b 100644
--- a/parser/parser.go
+++ b/parser/parser.go
@@ -899,6 +899,8 @@ func (p *parser) createNodeFromToken(ctx *context, tk *token.Token) (ast.Node, e
 		return p.parseTag(ctx)
 	case token.LiteralType, token.FoldedType:
 		return p.parseLiteral(ctx)
+	case token.MappingValueType:
+		return nil, errors.ErrSyntax("found an invalid key for this map", tk)
 	}
 	return nil, nil
 }


Test patch:
diff --git a/parser/parser_test.go b/parser/parser_test.go
index 34369c1..78baba9 100644
--- a/parser/parser_test.go
+++ b/parser/parser_test.go
@@ -1224,6 +1224,22 @@ a:
 			"key: [`val]",
 			"\n[1:7] found invalid token\n>  1 | key: [`val]\n             ^\n",
 		},
+		{
+			`{a: b}: v`,
+			`
+[1:7] found an invalid key for this map
+>  1 | {a: b}: v
+             ^
+`,
+		},
+		{
+			`[a]: v`,
+			`
+[1:4] found an invalid key for this map
+>  1 | [a]: v
+          ^
+`,
+		},
 	}
 	for _, test := range tests {
 		t.Run(test.source, func(t *testing.T) {
Repository: goccy/go-yaml
Pull request #532 (2024-11-13 10:39:24)

Fix comment position of map node has multiple values
fix https://github.com/goccy/go-yaml/issues/311


Patch:
diff --git a/parser/parser.go b/parser/parser.go
index ec54ce7..eee8232 100644
--- a/parser/parser.go
+++ b/parser/parser.go
@@ -388,7 +388,12 @@ func (p *parser) createMapValueNode(ctx *context, key ast.MapKeyNode, colonToken
 		return nil, err
 	}
 	if comment != nil {
-		_ = value.SetComment(comment)
+		nextLineComment := key.GetToken().Position.Line < comment.GetToken().Position.Line
+		if n, ok := value.(*ast.MappingNode); ok && nextLineComment && len(n.Values) > 1 {
+			_ = n.Values[0].SetComment(comment)
+		} else {
+			_ = value.SetComment(comment)
+		}
 	}
 	return value, nil
 }


Test patch:
diff --git a/parser/parser_test.go b/parser/parser_test.go
index 8d4e4d1..6221aaf 100644
--- a/parser/parser_test.go
+++ b/parser/parser_test.go
@@ -1560,6 +1560,63 @@ baz:
 	})
 }
 
+func TestCommentWithMap(t *testing.T) {
+	yml := `
+single:
+  # foo comment
+  foo: bar
+
+multiple:
+    # a comment
+    a: b
+    # c comment
+    c: d
+`
+
+	file, err := parser.ParseBytes([]byte(yml), parser.ParseComments)
+	if err != nil {
+		t.Fatal(err)
+	}
+	if len(file.Docs) == 0 {
+		t.Fatal("cannot get file docs")
+	}
+	if file.Docs[0].Body == nil {
+		t.Fatal("cannot get docs body")
+	}
+	mapNode, ok := file.Docs[0].Body.(*ast.MappingNode)
+	if !ok {
+		t.Fatalf("failed to get map node. got: %T\n", file.Docs[0].Body)
+	}
+	if len(mapNode.Values) != 2 {
+		t.Fatalf("failed to get map values. got %d", len(mapNode.Values))
+	}
+
+	singleNode, ok := mapNode.Values[0].Value.(*ast.MappingValueNode)
+	if !ok {
+		t.Fatalf("failed to get single node. got %T", mapNode.Values[0].Value)
+	}
+	if singleNode.GetComment().GetToken().Value != " foo comment" {
+		t.Fatalf("failed to get comment from single. got %q", singleNode.GetComment().GetToken().Value)
+	}
+
+	multiNode, ok := mapNode.Values[1].Value.(*ast.MappingNode)
+	if !ok {
+		t.Fatalf("failed to get multiple node. got: %T", mapNode.Values[1])
+	}
+	if multiNode.GetComment() != nil {
+		t.Fatalf("found unexpected comment")
+	}
+	if len(multiNode.Values) != 2 {
+		t.Fatalf("failed to get multiple node values. got %d", len(multiNode.Values))
+	}
+	if multiNode.Values[0].GetComment().GetToken().Value != " a comment" {
+		t.Fatalf("failed to get comment from multiple[0]. got %q", multiNode.Values[0].GetComment().GetToken().Value)
+	}
+	if multiNode.Values[1].GetComment().GetToken().Value != " c comment" {
+		t.Fatalf("failed to get comment from multiple[1]. got %q", multiNode.Values[1].GetComment().GetToken().Value)
+	}
+}
+
 func TestNodePath(t *testing.T) {
 	yml := `
 a: # commentA
Repository: goccy/go-yaml
Pull request #538 (2024-11-15 00:23:08)

Fix parsing of tab character in double-quote
fix https://github.com/goccy/go-yaml/issues/537

codecov-commenter: :warning: Please install the !['codecov app svg image'](https://github.com/codecov/engineering-team/assets/152432831/e90313f4-9d3a-4b63-8b54-cfe14e7ec20d) to ensure uploads and comments are reliably processed by Codecov.

## [Codecov](https://app.codecov.io/gh/goccy/go-yaml/pull/538?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Masaaki+Goshima) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 79.25%. Comparing base [(`8b2110b`)](https://app.codecov.io/gh/goccy/go-yaml/commit/8b2110bca955e6cfb99d81433de9b8d3df02f6e2?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Masaaki+Goshima) to head [(`af083b8`)](https://app.codecov.io/gh/goccy/go-yaml/commit/af083b813c9d4b62c548367a1da5bd5e2bc8505e?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Masaaki+Goshima).

:exclamation: Your organization needs to install the [Codecov GitHub app](https://github.com/apps/codecov/installations/select_target) to enable full functionality.

<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##           master     #538      +/-   ##
==========================================
+ Coverage   79.23%   79.25%   +0.01%     
==========================================
  Files          18       18              
  Lines        6257     6261       +4     
==========================================
+ Hits         4958     4962       +4     
  Misses        983      983              
  Partials      316      316              
```

</details>

Patch:
diff --git a/scanner/scanner.go b/scanner/scanner.go
index fbddf7d..366d18e 100644
--- a/scanner/scanner.go
+++ b/scanner/scanner.go
@@ -345,6 +345,10 @@ func (s *Scanner) scanDoubleQuote(ctx *Context) (*token.Token, error) {
 				progress = 1
 				ctx.addOriginBuf(nextChar)
 				value = append(value, '\r')
+			case 't':
+				progress = 1
+				ctx.addOriginBuf(nextChar)
+				value = append(value, '\t')
 			case 'v':
 				progress = 1
 				ctx.addOriginBuf(nextChar)


Test patch:
diff --git a/lexer/lexer_test.go b/lexer/lexer_test.go
index 7b678c4..b795041 100644
--- a/lexer/lexer_test.go
+++ b/lexer/lexer_test.go
@@ -38,6 +38,18 @@ func TestTokenize(t *testing.T) {
 				},
 			},
 		},
+		{
+			YAML: `"hello\tworld"`,
+			Tokens: token.Tokens{
+				{
+					Type:          token.DoubleQuoteType,
+					CharacterType: token.CharacterTypeIndicator,
+					Indicator:     token.QuotedScalarIndicator,
+					Value:         "hello\tworld",
+					Origin:        `"hello\tworld"`,
+				},
+			},
+		},
 		{
 			YAML: `0x_1A_2B_3C`,
 			Tokens: token.Tokens{
Repository: goccy/go-yaml
Pull request #539 (2024-11-15 09:57:56)

Clear pathMap keys
SSIA

codecov-commenter: :warning: Please install the !['codecov app svg image'](https://github.com/codecov/engineering-team/assets/152432831/e90313f4-9d3a-4b63-8b54-cfe14e7ec20d) to ensure uploads and comments are reliably processed by Codecov.

## [Codecov](https://app.codecov.io/gh/goccy/go-yaml/pull/539?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Masaaki+Goshima) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 79.25%. Comparing base [(`d7847db`)](https://app.codecov.io/gh/goccy/go-yaml/commit/d7847dbcfd7df97a7b74c90b3eff88b278cf178c?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Masaaki+Goshima) to head [(`23ede36`)](https://app.codecov.io/gh/goccy/go-yaml/commit/23ede366d2f5c8875d537b2e1d9e1c91610086b6?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Masaaki+Goshima).

:exclamation: Your organization needs to install the [Codecov GitHub app](https://github.com/apps/codecov/installations/select_target) to enable full functionality.

<details><summary>Additional details and impacted files</summary>


```diff
@@           Coverage Diff           @@
##           master     #539   +/-   ##
=======================================
  Coverage   79.25%   79.25%           
=======================================
  Files          18       18           
  Lines        6261     6262    +1     
=======================================
+ Hits         4962     4963    +1     
  Misses        983      983           
  Partials      316      316           
```

</details>

Patch:
diff --git a/parser/parser.go b/parser/parser.go
index 55db6b9..169d5ed 100644
--- a/parser/parser.go
+++ b/parser/parser.go
@@ -830,6 +830,7 @@ func (p *parser) setSameLineCommentIfExists(ctx *context, node ast.Node) error {
 }
 
 func (p *parser) parseDocument(ctx *context) (*ast.DocumentNode, error) {
+	p.pathMap = make(map[string]ast.Node)
 	startTk := p.currentToken()
 	p.progress(1) // skip document header token
 	body, err := p.parseToken(ctx, p.currentToken())


Test patch:
diff --git a/parser/parser_test.go b/parser/parser_test.go
index 7d0eb10..66ad5e3 100644
--- a/parser/parser_test.go
+++ b/parser/parser_test.go
@@ -133,6 +133,13 @@ a: !tag
 a:
   b: c
      
+`,
+		`
+foo: xxx
+---
+foo: yyy
+---
+foo: zzz
 `,
 	}
 	for _, src := range sources {