Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/gopls: stubmethods: "could not find the enclosing function of the return statement" bug in GetIfaceStubInfo #70666

Open
adonovan opened this issue Dec 3, 2024 · 7 comments
Assignees
Labels
gopls/telemetry-wins gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@adonovan adonovan added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. gopls/telemetry-wins labels Dec 3, 2024
@gopherbot gopherbot added this to the Unreleased milestone Dec 3, 2024
@adonovan
Copy link
Member Author

adonovan commented Dec 3, 2024

Another nonsensical backtrace.

@findleyr findleyr modified the milestones: Unreleased, gopls/v0.17.0 Dec 3, 2024
@findleyr findleyr self-assigned this Dec 3, 2024
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/633375 mentions this issue: gopls/internal/golang/stubmethods: refine crash into bug report

gopherbot pushed a commit to golang/tools that referenced this issue Dec 3, 2024
This CL refine an as-yet unreproducible crash into a bug report. It
seems clear that the code intended to check that sig != nil, yet instead
checked that sig.Results != nil. With that said, I don't think it's
possible to have a return statement without an enclosing signature. For
now, turn this into a bug report.

For golang/go#70666

Change-Id: I79031d437d643f6d70360e3abde86166176647b3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/633375
Reviewed-by: Alan Donovan <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/633715 mentions this issue: gopls/internal/golang/stubmethods: refine crash into bug report

@adonovan
Copy link
Member Author

adonovan commented Dec 4, 2024

func fromReturnStmt(fset *token.FileSet, info *types.Info, pos token.Pos, path []ast.Node, ret *ast.ReturnStmt) (*IfaceStubInfo, error) {
	// Find return operand containing pos.
	returnIdx := -1
	for i, r := range ret.Results {
		if r.Pos() <= pos && pos <= r.End() {
			returnIdx = i
			break
		}
	}
	if returnIdx == -1 {
		return nil, fmt.Errorf("pos %d not within return statement bounds: [%d-%d]", pos, ret.Pos(), ret.End())
	}

	concType, pointer := concreteType(ret.Results[returnIdx], info)
	if concType == nil || concType.Obj().Pkg() == nil {
		return nil, nil // result is not a named or *named or alias thereof
	}
	// Inv: the return is not a spread return,
	// such as "return f()" where f() has tuple type.
	conc := concType.Obj()
	if conc.Parent() != conc.Pkg().Scope() {
		return nil, fmt.Errorf("local type %q cannot be stubbed", conc.Name())
	}

	sig := typesutil.EnclosingSignature(path, info) // this is L0284
...

@prattmic Notice that all the lines matching L0284--the call to EnclosingSignature, which is not in the telemetry stack trace--are only loads from stack slots and the CALL itself: nothing really fallible.

golang.org/x/tools/gopls/internal/golang/stubmethods.fromReturnStmt STEXT size=1342 args=0x38 locals=0xe8 funcid=0x0 align=0x0
	0x0000 00000 	L0260	TEXT	golang.org/x/tools/gopls/internal/golang/stubmethods.fromReturnStmt(SB), ABIInternal, $232-56
	0x0000 00000 	L0260	LEAQ	-104(SP), R12
	0x0005 00005 	L0260	CMPQ	R12, 16(R14)
	0x0009 00009 	L0260	PCDATA	$0, $-2
	0x0009 00009 	L0260	JLS	1262
	0x000f 00015 	L0260	PCDATA	$0, $-1
	0x000f 00015 	L0260	PUSHQ	BP
	0x0010 00016 	L0260	MOVQ	SP, BP
	0x0013 00019 	L0260	SUBQ	$224, SP
	0x001a 00026 	L0260	FUNCDATA	$0, gclocals·NWx+SrsUzlioWlzBrPzI+Q==(SB)
	0x001a 00026 	L0260	FUNCDATA	$1, gclocals·kklnjQcr6q9LcTwyWFmazw==(SB)
	0x001a 00026 	L0260	FUNCDATA	$2, golang.org/x/tools/gopls/internal/golang/stubmethods.fromReturnStmt.stkobj(SB)
	0x001a 00026 	L0260	FUNCDATA	$5, golang.org/x/tools/gopls/internal/golang/stubmethods.fromReturnStmt.arginfo1(SB)
	0x001a 00026 	L0260	FUNCDATA	$6, golang.org/x/tools/gopls/internal/golang/stubmethods.fromReturnStmt.argliveinfo(SB)
	0x001a 00026 	L0260	PCDATA	$3, $1
	0x001a 00026 	L0263	MOVQ	AX, golang.org/x/tools/gopls/internal/golang/stubmethods.fset+240(SP)
	0x0022 00034 	L0263	MOVQ	BX, golang.org/x/tools/gopls/internal/golang/stubmethods.info+248(SP)
	0x002a 00042 	L0263	MOVQ	CX, golang.org/x/tools/gopls/internal/golang/stubmethods.pos+256(SP)
	0x0032 00050 	L0263	MOVQ	R9, golang.org/x/tools/gopls/internal/golang/stubmethods.ret+288(SP)
	0x003a 00058 	L0263	MOVQ	R8, golang.org/x/tools/gopls/internal/golang/stubmethods.path+280(SP)
	0x0042 00066 	L0263	MOVQ	SI, golang.org/x/tools/gopls/internal/golang/stubmethods.path+272(SP)
	0x004a 00074 	L0263	MOVQ	DI, golang.org/x/tools/gopls/internal/golang/stubmethods.path+264(SP)
	0x0052 00082 	L0263	PCDATA	$3, $-1
	0x0052 00082 	L0263	MOVQ	8(R9), DX
	0x0056 00086 	L0263	MOVQ	16(R9), R10
	0x005a 00090 	L0263	MOVQ	R10, golang.org/x/tools/gopls/internal/golang/stubmethods..autotmp_83+88(SP)
	0x005f 00095 	L0263	XORL	R11, R11
	0x0062 00098 	L0263	JMP	170
	0x0064 00100 	L0263	MOVQ	golang.org/x/tools/gopls/internal/golang/stubmethods..autotmp_84+120(SP), DX
	0x0069 00105 	L0263	ADDQ	$16, DX
	0x006d 00109 	L0263	MOVQ	golang.org/x/tools/gopls/internal/golang/stubmethods.returnIdx+64(SP), R11
	0x0072 00114 	L0263	INCQ	R11
	0x0075 00117 	L0301	MOVQ	golang.org/x/tools/gopls/internal/golang/stubmethods.fset+240(SP), AX
	0x007d 00125 	L0273	MOVQ	golang.org/x/tools/gopls/internal/golang/stubmethods.info+248(SP), BX
	0x0085 00133 	L0284	MOVQ	golang.org/x/tools/gopls/internal/golang/stubmethods.path+272(SP), SI
	0x008d 00141 	L0284	MOVQ	golang.org/x/tools/gopls/internal/golang/stubmethods.path+264(SP), DI
	0x0095 00149 	L0284	MOVQ	golang.org/x/tools/gopls/internal/golang/stubmethods.path+280(SP), R8
	0x009d 00157 	L0273	MOVQ	golang.org/x/tools/gopls/internal/golang/stubmethods.ret+288(SP), R9
	0x00a5 00165 	L0263	MOVQ	golang.org/x/tools/gopls/internal/golang/stubmethods..autotmp_83+88(SP), R10
	0x00aa 00170 	L0263	CMPQ	R11, R10
	0x00ad 00173 	L0263	JGE	326
	0x00b3 00179 	L0263	MOVQ	R11, golang.org/x/tools/gopls/internal/golang/stubmethods.returnIdx+64(SP)
	0x00b8 00184 	L0263	MOVQ	DX, golang.org/x/tools/gopls/internal/golang/stubmethods..autotmp_84+120(SP)
	0x00bd 00189 	L0263	MOVQ	(DX), CX
	0x00c0 00192 	L0263	MOVQ	CX, golang.org/x/tools/gopls/internal/golang/stubmethods.r.itab+72(SP)
	0x00c5 00197 	L0263	MOVQ	8(DX), AX
	0x00c9 00201 	L0263	MOVQ	AX, golang.org/x/tools/gopls/internal/golang/stubmethods.r.data+96(SP)
	0x00ce 00206 	L0264	MOVQ	32(CX), CX
	0x00d2 00210 	L0264	PCDATA	$1, $1
	0x00d2 00210 	L0264	CALL	CX
	0x00d4 00212 	L0264	MOVQ	golang.org/x/tools/gopls/internal/golang/stubmethods.pos+256(SP), CX
	0x00dc 00220 	L0264	NOP
	0x00e0 00224 	L0264	CMPQ	AX, CX
	0x00e3 00227 	L0264	JLE	233
	0x00e5 00229 	L0264	XORL	DX, DX
	0x00e7 00231 	L0264	JMP	263
	0x00e9 00233 	L0264	MOVQ	golang.org/x/tools/gopls/internal/golang/stubmethods.r.itab+72(SP), CX
	0x00ee 00238 	L0264	MOVQ	24(CX), CX
	0x00f2 00242 	L0264	MOVQ	golang.org/x/tools/gopls/internal/golang/stubmethods.r.data+96(SP), AX
	0x00f7 00247 	L0264	PCDATA	$1, $2
	0x00f7 00247 	L0264	CALL	CX
	0x00f9 00249 	L0264	MOVQ	golang.org/x/tools/gopls/internal/golang/stubmethods.pos+256(SP), CX
	0x0101 00257 	L0264	CMPQ	AX, CX
	0x0104 00260 	L0264	SETGE	DL
	0x0107 00263 	L0264	TESTB	DL, DL
	0x0109 00265 	L0264	JEQ	100
	0x010f 00271 	L0301	MOVQ	golang.org/x/tools/gopls/internal/golang/stubmethods.fset+240(SP), AX
	0x0117 00279 	L0273	MOVQ	golang.org/x/tools/gopls/internal/golang/stubmethods.info+248(SP), BX

	0x011f 00287 	L0284	MOVQ	golang.org/x/tools/gopls/internal/golang/stubmethods.path+272(SP), SI
	0x0127 00295 	L0284	MOVQ	golang.org/x/tools/gopls/internal/golang/stubmethods.path+264(SP), DI
	0x012f 00303 	L0284	MOVQ	golang.org/x/tools/gopls/internal/golang/stubmethods.path+280(SP), R8

	0x0137 00311 	L0273	MOVQ	golang.org/x/tools/gopls/internal/golang/stubmethods.ret+288(SP), R9
	0x013f 00319 	L0269	MOVQ	golang.org/x/tools/gopls/internal/golang/stubmethods.returnIdx+64(SP), DX
	0x0144 00324 	L0266	JMP	333
	0x0146 00326 	L0266	MOVQ	$-1, DX
	0x014d 00333 	L0269	CMPQ	DX, $-1
	0x0151 00337 	L0269	JEQ	1045
	0x0157 00343 	L0273	MOVQ	16(R9), CX
	0x015b 00347 	L0273	NOP
	0x0160 00352 	L0273	CMPQ	DX, CX
	0x0163 00355 	L0273	JCC	1253
	0x0169 00361 	L0269	MOVQ	DX, golang.org/x/tools/gopls/internal/golang/stubmethods.returnIdx+64(SP)
	0x016e 00366 	L0273	MOVQ	8(R9), SI
	0x0172 00370 	L0273	SHLQ	$4, DX
	0x0176 00374 	L0273	MOVQ	(SI)(DX*1), AX
	0x017a 00378 	L0273	MOVQ	8(SI)(DX*1), DX
	0x017f 00383 	L0273	MOVQ	BX, CX
	0x0182 00386 	L0273	MOVQ	DX, BX
	0x0185 00389 	L0273	PCDATA	$1, $0
	0x0185 00389 	L0273	CALL	golang.org/x/tools/gopls/internal/golang/stubmethods.concreteType(SB)
	0x018a 00394 	L0274	TESTQ	AX, AX
	0x018d 00397 	L0274	JEQ	1030
	0x0193 00403 	L0308	MOVQ	32(AX), DX
	0x0197 00407 	     	NOP
	0x0197 00407 	L0308	TESTQ	DX, DX
	0x019a 00410 	L0308	JEQ	421
	0x019c 00412 	L0311	MOVQ	(DX), SI
	0x019f 00415 	L0311	MOVQ	8(SI), SI
	0x01a3 00419 	L0274	JMP	425
	0x01a5 00421 	L0309	MOVQ	8(AX), SI
	0x01a9 00425 	     	NOP
	0x01a9 00425 	L0274	CMPQ	16(SI), $0
	0x01ae 00430 	L0274	JEQ	1030
	0x01b4 00436 	     	NOP
	0x01b4 00436 	L0308	TESTQ	DX, DX
	0x01b7 00439 	L0308	JEQ	450
	0x01b9 00441 	L0311	MOVQ	(DX), DX
	0x01bc 00444 	L0311	MOVQ	8(DX), DX
	0x01c0 00448 	L0279	JMP	454
	0x01c2 00450 	L0309	MOVQ	8(AX), DX
	0x01c6 00454 	L0280	MOVQ	16(DX), SI
	0x01ca 00458 	     	NOP
	0x01ca 00458 	     	NOP
	0x01ca 00458 	     	NOP
	0x01ca 00458 	L0053	TESTQ	SI, SI
	0x01cd 00461 	L0053	JEQ	469
	0x01cf 00463 	L0054	MOVQ	32(SI), SI
	0x01d3 00467 	L0280	JMP	476
	0x01d5 00469 	L0280	MOVQ	go/types.Universe(SB), SI
	0x01dc 00476 	L0145	MOVQ	(DX), R8
	0x01df 00479 	L0145	NOP
	0x01e0 00480 	L0280	CMPQ	SI, R8
	0x01e3 00483 	L0280	JNE	935
	0x01e9 00489 	L0273	MOVQ	AX, golang.org/x/tools/gopls/internal/golang/stubmethods.concType+112(SP)
	0x01ee 00494 	L0273	MOVB	BL, golang.org/x/tools/gopls/internal/golang/stubmethods.pointer+47(SP)

	0x01f2 00498 	L0284	MOVQ	golang.org/x/tools/gopls/internal/golang/stubmethods.path+264(SP), AX
	0x01fa 00506 	L0284	MOVQ	golang.org/x/tools/gopls/internal/golang/stubmethods.path+272(SP), BX
	0x0202 00514 	L0284	MOVQ	golang.org/x/tools/gopls/internal/golang/stubmethods.path+280(SP), CX
	0x020a 00522 	L0284	MOVQ	golang.org/x/tools/gopls/internal/golang/stubmethods.info+248(SP), DI
	0x0212 00530 	L0284	PCDATA	$1, $3
	0x0212 00530 	L0284	CALL	golang.org/x/tools/gopls/internal/util/typesutil.EnclosingSignature(SB)

	0x0217 00535 	L0096	MOVQ	40(AX), DX
	0x021b 00539 	     	NOP
	0x021b 00539 	     	NOP
	0x0220 00544 	L0285	TESTQ	DX, DX
	0x0223 00547 	L0285	JEQ	894
	0x0229 00553 	L0291	MOVQ	golang.org/x/tools/gopls/internal/golang/stubmethods.ret+288(SP), SI
	0x0231 00561 	L0291	MOVQ	16(SI), AX
	0x0235 00565 	L0291	CMPQ	8(DX), AX
	0x0239 00569 	L0291	JNE	756
	0x023f 00575 	L0034	MOVQ	8(DX), CX
	0x0243 00579 	     	NOP
	0x0243 00579 	L0034	MOVQ	golang.org/x/tools/gopls/internal/golang/stubmethods.returnIdx+64(SP), AX
	0x0248 00584 	L0034	CMPQ	AX, CX
	0x024b 00587 	L0034	JCC	1248
	0x0251 00593 	L0034	MOVQ	(DX), CX
	0x0254 00596 	L0034	MOVQ	(CX)(AX*8), CX
	0x0258 00600 	L0296	MOVQ	40(CX), AX
	0x025c 00604 	L0158	MOVQ	48(CX), BX
	0x0260 00608 	     	NOP
	0x0260 00608 	L0296	PCDATA	$1, $4
	0x0260 00608 	L0296	CALL	golang.org/x/tools/gopls/internal/golang/stubmethods.ifaceObjFromType(SB)
	0x0265 00613 	L0297	TESTQ	AX, AX
	0x0268 00616 	L0297	JEQ	741
	0x026a 00618 	L0296	MOVQ	AX, golang.org/x/tools/gopls/internal/golang/stubmethods.iface+104(SP)
	0x026f 00623 	L0300	LEAQ	type:golang.org/x/tools/gopls/internal/golang/stubmethods.IfaceStubInfo(SB), AX
	0x0276 00630 	L0300	PCDATA	$1, $5
	0x0276 00630 	L0300	CALL	runtime.newobject(SB)
	0x027b 00635 	L0301	CMPL	runtime.writeBarrier(SB), $0
	0x0282 00642 	L0301	PCDATA	$0, $-2
	0x0282 00642 	L0301	JNE	664
	0x0284 00644 	L0301	MOVQ	golang.org/x/tools/gopls/internal/golang/stubmethods.fset+240(SP), DX
	0x028c 00652 	L0302	MOVQ	golang.org/x/tools/gopls/internal/golang/stubmethods.concType+112(SP), SI
	0x0291 00657 	L0304	MOVQ	golang.org/x/tools/gopls/internal/golang/stubmethods.iface+104(SP), DI
	0x0296 00662 	L0301	JMP	698
	0x0298 00664 	L0301	CALL	runtime.gcWriteBarrier3(SB)
	0x029d 00669 	L0301	MOVQ	golang.org/x/tools/gopls/internal/golang/stubmethods.fset+240(SP), DX
	0x02a5 00677 	L0301	MOVQ	DX, (R11)
	0x02a8 00680 	L0302	MOVQ	golang.org/x/tools/gopls/internal/golang/stubmethods.concType+112(SP), SI
	0x02ad 00685 	L0302	MOVQ	SI, 8(R11)
	0x02b1 00689 	L0304	MOVQ	golang.org/x/tools/gopls/internal/golang/stubmethods.iface+104(SP), DI
	0x02b6 00694 	L0304	MOVQ	DI, 16(R11)
	0x02ba 00698 	L0301	MOVQ	DX, (AX)
	0x02bd 00701 	L0302	LEAQ	go:itab.*go/types.Named,golang.org/x/tools/internal/typesinternal.NamedOrAlias(SB), DX
	0x02c4 00708 	L0302	MOVQ	DX, 16(AX)
	0x02c8 00712 	L0302	MOVQ	SI, 24(AX)
	0x02cc 00716 	L0303	MOVBLZX	golang.org/x/tools/gopls/internal/golang/stubmethods.pointer+47(SP), DX
	0x02d1 00721 	L0303	MOVB	DL, 32(AX)
	0x02d4 00724 	L0304	MOVQ	DI, 8(AX)
	0x02d8 00728 	L0300	PCDATA	$0, $-1
	0x02d8 00728 	L0300	XORL	BX, BX
	0x02da 00730 	L0300	XORL	CX, CX
	0x02dc 00732 	L0305	ADDQ	$224, SP
	0x02e3 00739 	L0305	POPQ	BP
	0x02e4 00740 	L0305	RET
	0x02e5 00741 	L0298	XORL	AX, AX
	0x02e7 00743 	L0298	XORL	BX, BX
	0x02e9 00745 	L0298	XORL	CX, CX
	0x02eb 00747 	L0298	ADDQ	$224, SP
	0x02f2 00754 	L0298	POPQ	BP
	0x02f3 00755 	L0298	RET
	0x02f4 00756 	L0028	MOVQ	8(DX), CX
	0x02f8 00760 	L0028	MOVQ	CX, golang.org/x/tools/gopls/internal/golang/stubmethods.~r0+48(SP)
	0x02fd 00765 	     	NOP
	0x02fd 00765 	L0292	MOVUPS	X15, golang.org/x/tools/gopls/internal/golang/stubmethods..autotmp_57+128(SP)
	0x0306 00774 	L0292	MOVUPS	X15, golang.org/x/tools/gopls/internal/golang/stubmethods..autotmp_57+144(SP)
	0x030f 00783 	L0293	PCDATA	$1, $6
	0x030f 00783 	L0293	CALL	runtime.convT64(SB)
	0x0314 00788 	L0293	LEAQ	type:int(SB), CX
	0x031b 00795 	L0293	MOVQ	CX, golang.org/x/tools/gopls/internal/golang/stubmethods..autotmp_57+128(SP)
	0x0323 00803 	L0293	MOVQ	AX, golang.org/x/tools/gopls/internal/golang/stubmethods..autotmp_57+136(SP)
	0x032b 00811 	L0294	MOVQ	golang.org/x/tools/gopls/internal/golang/stubmethods.~r0+48(SP), AX
	0x0330 00816 	L0294	CALL	runtime.convT64(SB)
	0x0335 00821 	L0294	LEAQ	type:int(SB), CX
	0x033c 00828 	L0294	MOVQ	CX, golang.org/x/tools/gopls/internal/golang/stubmethods..autotmp_57+144(SP)
	0x0344 00836 	L0294	MOVQ	AX, golang.org/x/tools/gopls/internal/golang/stubmethods..autotmp_57+152(SP)
	0x034c 00844 	L0292	LEAQ	go:string."%d-operand return statement in %d-result function"(SB), AX
	0x0353 00851 	L0292	MOVL	$49, BX
	0x0358 00856 	L0292	LEAQ	golang.org/x/tools/gopls/internal/golang/stubmethods..autotmp_57+128(SP), CX
	0x0360 00864 	L0292	MOVL	$2, DI
	0x0365 00869 	L0292	MOVQ	DI, SI
	0x0368 00872 	L0292	PCDATA	$1, $7
	0x0368 00872 	L0292	CALL	fmt.Errorf(SB)
	0x036d 00877 	L0292	MOVQ	BX, CX
	0x0370 00880 	L0292	MOVQ	AX, BX
	0x0373 00883 	L0292	XORL	AX, AX
	0x0375 00885 	L0292	ADDQ	$224, SP
	0x037c 00892 	L0292	POPQ	BP
	0x037d 00893 	L0292	RET
	0x037e 00894 	L0286	LEAQ	go:string."could not find the enclosing function of the return statement"(SB), AX
	0x0385 00901 	L0286	MOVL	$61, BX
	0x038a 00906 	L0286	XORL	CX, CX
	0x038c 00908 	L0286	XORL	DI, DI
	0x038e 00910 	L0286	MOVQ	DI, SI
	0x0391 00913 	L0286	CALL	fmt.Errorf(SB)
	0x0396 00918 	L0286	MOVQ	BX, CX
	0x0399 00921 	L0286	MOVQ	AX, BX
	0x039c 00924 	L0286	XORL	AX, AX
	0x039e 00926 	L0286	ADDQ	$224, SP
	0x03a5 00933 	L0286	POPQ	BP
	0x03a6 00934 	L0286	RET
	0x03a7 00935 	L0155	MOVQ	32(DX), BX
	0x03ab 00939 	L0155	MOVQ	24(DX), AX
	0x03af 00943 	     	NOP
	0x03af 00943 	L0281	MOVUPS	X15, golang.org/x/tools/gopls/internal/golang/stubmethods..autotmp_54+160(SP)
	0x03b8 00952 	L0281	PCDATA	$1, $8
	0x03b8 00952 	L0281	CALL	runtime.convTstring(SB)
	0x03bd 00957 	L0281	LEAQ	type:string(SB), CX
	0x03c4 00964 	L0281	MOVQ	CX, golang.org/x/tools/gopls/internal/golang/stubmethods..autotmp_54+160(SP)
	0x03cc 00972 	L0281	MOVQ	AX, golang.org/x/tools/gopls/internal/golang/stubmethods..autotmp_54+168(SP)
	0x03d4 00980 	L0281	LEAQ	go:string."local type %q cannot be stubbed"(SB), AX
	0x03db 00987 	L0281	MOVL	$31, BX
	0x03e0 00992 	L0281	LEAQ	golang.org/x/tools/gopls/internal/golang/stubmethods..autotmp_54+160(SP), CX
	0x03e8 01000 	L0281	MOVL	$1, DI
	0x03ed 01005 	L0281	MOVQ	DI, SI
	0x03f0 01008 	L0281	PCDATA	$1, $7
	0x03f0 01008 	L0281	CALL	fmt.Errorf(SB)
	0x03f5 01013 	L0281	MOVQ	BX, CX
	0x03f8 01016 	L0281	MOVQ	AX, BX
	0x03fb 01019 	L0281	XORL	AX, AX
	0x03fd 01021 	L0281	ADDQ	$224, SP
	0x0404 01028 	L0281	POPQ	BP
	0x0405 01029 	L0281	RET
	0x0406 01030 	L0275	XORL	AX, AX
	0x0408 01032 	L0275	XORL	BX, BX
	0x040a 01034 	L0275	XORL	CX, CX
	0x040c 01036 	L0275	ADDQ	$224, SP
	0x0413 01043 	L0275	POPQ	BP
	0x0414 01044 	L0275	RET
	0x0415 01045 	L0787	MOVQ	(R9), CX
	0x0418 01048 	L0787	MOVQ	CX, golang.org/x/tools/gopls/internal/golang/stubmethods.~r0+56(SP)
	0x041d 01053 	     	NOP
	0x041d 01053 	L0270	MOVQ	R9, AX
	0x0420 01056 	L0270	CALL	go/ast.(*ReturnStmt).End(SB)
	0x0425 01061 	L0270	MOVQ	AX, golang.org/x/tools/gopls/internal/golang/stubmethods..autotmp_85+80(SP)
	0x042a 01066 	L0270	MOVUPS	X15, golang.org/x/tools/gopls/internal/golang/stubmethods..autotmp_51+176(SP)
	0x0433 01075 	L0270	MOVUPS	X15, golang.org/x/tools/gopls/internal/golang/stubmethods..autotmp_51+192(SP)
	0x043c 01084 	L0270	MOVUPS	X15, golang.org/x/tools/gopls/internal/golang/stubmethods..autotmp_51+208(SP)
	0x0445 01093 	L0270	MOVQ	golang.org/x/tools/gopls/internal/golang/stubmethods.pos+256(SP), AX
	0x044d 01101 	L0270	PCDATA	$1, $9
	0x044d 01101 	L0270	CALL	runtime.convT64(SB)
	0x0452 01106 	L0270	LEAQ	type:go/token.Pos(SB), CX
	0x0459 01113 	L0270	MOVQ	CX, golang.org/x/tools/gopls/internal/golang/stubmethods..autotmp_51+176(SP)
	0x0461 01121 	L0270	MOVQ	AX, golang.org/x/tools/gopls/internal/golang/stubmethods..autotmp_51+184(SP)
	0x0469 01129 	L0270	MOVQ	golang.org/x/tools/gopls/internal/golang/stubmethods.~r0+56(SP), AX
	0x046e 01134 	L0270	CALL	runtime.convT64(SB)
	0x0473 01139 	L0270	LEAQ	type:go/token.Pos(SB), CX
	0x047a 01146 	L0270	MOVQ	CX, golang.org/x/tools/gopls/internal/golang/stubmethods..autotmp_51+192(SP)
	0x0482 01154 	L0270	MOVQ	AX, golang.org/x/tools/gopls/internal/golang/stubmethods..autotmp_51+200(SP)
	0x048a 01162 	L0270	MOVQ	golang.org/x/tools/gopls/internal/golang/stubmethods..autotmp_85+80(SP), AX
	0x048f 01167 	L0270	CALL	runtime.convT64(SB)
	0x0494 01172 	L0270	LEAQ	type:go/token.Pos(SB), CX
	0x049b 01179 	L0270	MOVQ	CX, golang.org/x/tools/gopls/internal/golang/stubmethods..autotmp_51+208(SP)
	0x04a3 01187 	L0270	MOVQ	AX, golang.org/x/tools/gopls/internal/golang/stubmethods..autotmp_51+216(SP)
	0x04ab 01195 	L0270	LEAQ	go:string."pos %d not within return statement bounds: [%d-%d]"(SB), AX
	0x04b2 01202 	L0270	MOVL	$50, BX
	0x04b7 01207 	L0270	LEAQ	golang.org/x/tools/gopls/internal/golang/stubmethods..autotmp_51+176(SP), CX
	0x04bf 01215 	L0270	MOVL	$3, DI
	0x04c4 01220 	L0270	MOVQ	DI, SI
	0x04c7 01223 	L0270	PCDATA	$1, $7
	0x04c7 01223 	L0270	CALL	fmt.Errorf(SB)
	0x04cc 01228 	L0270	MOVQ	BX, CX
	0x04cf 01231 	L0270	MOVQ	AX, BX
	0x04d2 01234 	L0270	XORL	AX, AX
	0x04d4 01236 	L0270	ADDQ	$224, SP
	0x04db 01243 	L0270	POPQ	BP
	0x04dc 01244 	L0270	RET
	0x04dd 01245 	L0270	NOP
	0x04e0 01248 	L0034	CALL	runtime.panicIndex(SB)
	0x04e5 01253 	L0273	MOVQ	DX, AX
	0x04e8 01256 	L0273	CALL	runtime.panicIndex(SB)
	0x04ed 01261 	L0273	XCHGL	AX, AX
	0x04ee 01262 	L0273	NOP
	0x04ee 01262 	L0260	PCDATA	$1, $-1
	0x04ee 01262 	L0260	PCDATA	$0, $-2
	0x04ee 01262 	L0260	MOVQ	AX, 8(SP)
	0x04f3 01267 	L0260	MOVQ	BX, 16(SP)
	0x04f8 01272 	L0260	MOVQ	CX, 24(SP)
	0x04fd 01277 	L0260	MOVQ	DI, 32(SP)
	0x0502 01282 	L0260	MOVQ	SI, 40(SP)
	0x0507 01287 	L0260	MOVQ	R8, 48(SP)
	0x050c 01292 	L0260	MOVQ	R9, 56(SP)
	0x0511 01297 	L0260	CALL	runtime.morestack_noctxt(SB)
	0x0516 01302 	L0260	PCDATA	$0, $-1
	0x0516 01302 	L0260	MOVQ	8(SP), AX
	0x051b 01307 	L0260	MOVQ	16(SP), BX
	0x0520 01312 	L0260	MOVQ	24(SP), CX
	0x0525 01317 	L0260	MOVQ	32(SP), DI
	0x052a 01322 	L0260	MOVQ	40(SP), SI
	0x052f 01327 	L0260	MOVQ	48(SP), R8
	0x0534 01332 	L0260	MOVQ	56(SP), R9
	0x0539 01337 	L0260	JMP	0

@findleyr findleyr modified the milestones: gopls/v0.17.0, gopls/v0.18.0 Dec 5, 2024
@findleyr findleyr changed the title x/tools/gopls: panic in GetIfaceStubInfo x/tools/gopls: bug report in GetIfaceStubInfo Dec 5, 2024
@adonovan adonovan changed the title x/tools/gopls: bug report in GetIfaceStubInfo x/tools/gopls: stubmethods: "could not find the enclosing function of the return statement" bug in GetIfaceStubInfo Dec 23, 2024
@adonovan
Copy link
Member Author

One possibility: there is an enclosing Func{Decl,Lit}, but the type checker has failed to record an Info.{Defs,Types} for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls/telemetry-wins gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

4 participants