Skip to content

[LS] Crashing on incomplete dictionary types #465

@jribbink

Description

@jribbink

When I create an incomplete dictionary type, such as:

access(all) contract Foo {
    access(all) let dict: @{String: }
    init() {}
}

The language server will crash with the following error:

goroutine 45 [running]:
github.com/onflow/cadence/ast.(*DictionaryType).Doc(0x1400132b4f0)
	github.com/onflow/[email protected]/ast/type.go:412 +0x40
github.com/onflow/cadence/ast.Prettier({0x1058f7000, 0x1400132b4f0})
	github.com/onflow/[email protected]/ast/prettier.go:29 +0x40
github.com/onflow/cadence/ast.(*DictionaryType).String(0x140013bfd40?)
	github.com/onflow/[email protected]/ast/type.go:398 +0x28
github.com/onflow/cadence-tools/lint.(*cadenceV1Analyzer).AnalyzeAll.(*cadenceV1Analyzer).analyzeRemovedTypeIdentifiers.func2(0x1400138fc50)
	github.com/onflow/cadence-tools/[email protected]/cadence_v1_analyzer.go:171 +0x34
github.com/onflow/cadence-tools/lint.(*cadenceV1Analyzer).inspectTypeAnnotations.func1(0x140000a6c48?)
	github.com/onflow/cadence-tools/[email protected]/cadence_v1_analyzer.go:279 +0x90
github.com/onflow/cadence-tools/lint.(*cadenceV1Analyzer).inspectTypeAnnotations.func3({0x10591a580?, 0x14001eae5a0})
	github.com/onflow/cadence-tools/[email protected]/cadence_v1_analyzer.go:309 +0x174
github.com/onflow/cadence/ast.(*Inspector).Preorder(0x14002009728, {0x140000a6d08?, 0x7f?, 0x102cbb7b8?}, 0x140000a6cf0)
	github.com/onflow/[email protected]/ast/inspector.go:87 +0x8c
github.com/onflow/cadence-tools/lint.(*cadenceV1Analyzer).inspectTypeAnnotations(0x14002009728?, 0x1400024ddd8?)
	github.com/onflow/cadence-tools/[email protected]/cadence_v1_analyzer.go:295 +0x110
github.com/onflow/cadence-tools/lint.(*cadenceV1Analyzer).analyzeRemovedTypeIdentifiers(...)
	github.com/onflow/cadence-tools/[email protected]/cadence_v1_analyzer.go:170
github.com/onflow/cadence-tools/lint.(*cadenceV1Analyzer).AnalyzeAll(0x140009f2360)
	github.com/onflow/cadence-tools/[email protected]/cadence_v1_analyzer.go:69 +0x78
github.com/onflow/cadence-tools/lint.init.init.func1.func7(0x1054d8720?)
	github.com/onflow/cadence-tools/[email protected]/cadence_v1_analyzer.go:43 +0x20
github.com/onflow/cadence/tools/analysis.(*Program).Run.func2.1()
	github.com/onflow/[email protected]/tools/analysis/program.go:85 +0x180
sync.(*Once).doSlow(0x0?, 0x0?)
	sync/once.go:78 +0xf0
sync.(*Once).Do(...)
	sync/once.go:69
github.com/onflow/cadence/tools/analysis.(*Program).Run.func2(0x106fa53a0)
	github.com/onflow/[email protected]/tools/analysis/program.go:67 +0xb0
github.com/onflow/cadence/tools/analysis.(*Program).Run.func3.1(0x0?)
	github.com/onflow/[email protected]/tools/analysis/program.go:94 +0x30
created by github.com/onflow/cadence/tools/analysis.(*Program).Run.func3 in goroutine 40
	github.com/onflow/[email protected]/tools/analysis/program.go:93 +0x4c
[Error - 4:12:37 PM] The Cadence server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
[Error - 4:12:37 PM] Server process exited with code 2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions