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: streams_map_incoming_bidi.go
    path of file: ./repos/sealer/vendor/github.com/lucas-clemente/quic-go
    
    the code of the file until where you have to start completion: // This file was automatically generated by genny.
// Any changes will be lost if this file is regenerated.
// see https://github.com/cheekybits/genny

package quic

import (
	"context"
	"sync"

	"github.com/lucas-clemente/quic-go/internal
    
func (m *incomingBidiStreamsMap) deleteStream(num protocol.StreamNum) error {
	if _, ok := m.streams[num]; !ok {
		return streamError{
			message: "tried to delete unknown incoming stream %d",
			nums:    []protocol.StreamNum{num},
		}
	}

	// Don't delete this stream yet, if it was not yet accepted.
	// Just save it to streamsToDelete map, to make sure it is deleted as soon as it gets accepted.
	if num >= m.nextStreamToAccept {
		entry, ok := m.streams[num]
		if ok && entry.shouldDelete {
			return streamError{
				message: "tried to delete incoming stream %d multiple times",
				nums:    []protocol.StreamNum{num},
			}
		}
		entry.shouldDelete = true
		m.streams[num] = entry // can't assign to struct in map, so we need to reassign
		return nil
	}

	delete(m.streams, num)
	// queue a MAX_STREAM_ID frame, giving the peer the option to open a new stream
	if m.maxNumStreams > uint64(len(m.streams)) {
		maxStream := m.nextStreamToOpen + protocol.StreamNum(m.maxNumStreams-uint64(len(m.streams))) - 1
		// Never send a value larger than protocol.MaxStreamCount.
		if maxStream <= protocol.MaxStreamCount {
			m.maxStream = maxStream
			m.queueMaxStreamID(&wire.MaxStreamsFrame{
				Type:         protocol.StreamTypeBidi,
				MaxStreamNum: m.maxStream,
			})
		}
	}
	return nil
}