You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: component_instance_results.go
    path of file: ./repos/terraform/internal/stacks/stackruntime/internal/stackeval
    
    the code of the file until where you have to start completion: // Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1

package stackeval

import (
	"github.com/hashicorp/terraform/internal/addrs"
	"github.com/hashicorp/terraform/internal/plans"
	"github.com/hashicorp/terraform/internal/states"
)

type ComponentInstanceApplyResult struct {
	// FinalState is the final state snapshot returned by the modules runtime
	// after the apply phase completed.
	FinalState *states.State

	// AffectedResourceInstanceObjects is a set of the addresses of all
	// resource instance objects that might've been affected by any part
	// of this apply process.
	//
	// This includes both objects that had real planned changes and also
	// objects that might have had their state updated by the refresh actions
	// during plan, even though no external actions were taken during the
	// apply phase
    
func resourceInstanceObjectsAffectedByPlan(plan *plans.Plan) addrs.Set[addrs.AbsResourceInstanceObject] {
	// For now we conservatively just enumerate everything that exists
	// either before or after the change. This is technically more than
	// we strictly need to return -- it will include objects that have
	// no planned change and whose refresh step changed nothing -- but
	// it's better to over-report than to under-report because under-reporting
	// will cause stale objects to get left in the state.

	ret := addrs.MakeSet[addrs.AbsResourceInstanceObject]()
	if plan.Changes != nil {
		for _, ch := range plan.Changes.Resources {
			ret.Add(ch.ObjectAddr())
		}
	}
	if plan.PriorState != nil {
		for _, addr := range plan.PriorState.AllResourceInstanceObjectAddrs() {
			ret.Add(addr)
		}
	}
	if plan.PrevRunState != nil {
		for _, addr := range plan.PrevRunState.AllResourceInstanceObjectAddrs() {
			ret.Add(addr)
		}
	}
	return ret
}