| ... | @@ -1906,8 +1906,6 @@ fn failWithOwnedErrorMsg(sema: *Sema, err_msg: *Module.ErrorMsg) CompileError { | ... | @@ -1906,8 +1906,6 @@ fn failWithOwnedErrorMsg(sema: *Sema, err_msg: *Module.ErrorMsg) CompileError { |
| 1906 | } | 1906 | } |
| 1907 | | 1907 | |
| 1908 | const mod = sema.mod; | 1908 | const mod = sema.mod; |
| 1909 | sema.err = err_msg; | | |
| 1910 | | | |
| 1911 | { | 1909 | { |
| 1912 | errdefer err_msg.destroy(mod.gpa); | 1910 | errdefer err_msg.destroy(mod.gpa); |
| 1913 | if (err_msg.src_loc.lazy == .unneeded) { | 1911 | if (err_msg.src_loc.lazy == .unneeded) { |
| ... | @@ -1925,8 +1923,10 @@ fn failWithOwnedErrorMsg(sema: *Sema, err_msg: *Module.ErrorMsg) CompileError { | ... | @@ -1925,8 +1923,10 @@ fn failWithOwnedErrorMsg(sema: *Sema, err_msg: *Module.ErrorMsg) CompileError { |
| 1925 | const gop = mod.failed_decls.getOrPutAssumeCapacity(sema.owner_decl_index); | 1923 | const gop = mod.failed_decls.getOrPutAssumeCapacity(sema.owner_decl_index); |
| 1926 | if (gop.found_existing) { | 1924 | if (gop.found_existing) { |
| 1927 | // If there are multiple errors for the same Decl, prefer the first one added. | 1925 | // If there are multiple errors for the same Decl, prefer the first one added. |
| | 1926 | sema.err = null; |
| 1928 | err_msg.destroy(mod.gpa); | 1927 | err_msg.destroy(mod.gpa); |
| 1929 | } else { | 1928 | } else { |
| | 1929 | sema.err = err_msg; |
| 1930 | gop.value_ptr.* = err_msg; | 1930 | gop.value_ptr.* = err_msg; |
| 1931 | } | 1931 | } |
| 1932 | return error.AnalysisFail; | 1932 | return error.AnalysisFail; |