hashicorp / hashicorp/hcl

Testsuite failure: TestExpressionErrorMessages

Open
#556 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
5.8k
Forks
657
Avg merge
20h 36m
Merged PRs (30d)
6

Description

Hi,

I'm working on updating the `golang-github-hashicorp-hcl-dev` package in Debian unstable (probably by introducing a new `golang-github-hashicorp-hcl-v2-dev` package that reverse-dependencies can switch to), and I'm facing the following test suite failure with v2.14.1:

```
=== RUN TestExpressionErrorMessages
=== RUN TestExpressionErrorMessages/true_?_1_:_true
=== RUN TestExpressionErrorMessages/true_?_[1]_:_[true]
=== RUN TestExpressionErrorMessages/true_?_[1]_:_[1,_true]
=== RUN TestExpressionErrorMessages/true_?_{_a_=_1_}_:_{_a_=_true_}
=== RUN TestExpressionErrorMessages/true_?_{_a_=_true,_b_=_1_}_:_{_a_=_true_}
=== RUN TestExpressionErrorMessages/true_?_{_a_=_true_}_:_{_a_=_true,_b_=_1_}
=== RUN TestExpressionErrorMessages/true_?_listOf1Tuple_:_listOf0Tuple
expression_test.go:1997: unexpected success
want error:
Inconsistent conditional result types; The true and false result expressions must have consistent types. Mismatched list element types: The 'true' tuple has length 1, but the 'false' tuple has length 0.
=== RUN TestExpressionErrorMessages/true_?_setOf1Tuple_:_setOf0Tuple
expression_test.go:1997: unexpected success
want error:
Inconsistent conditional result types; The true and false result expressions must have consistent types. Mismatched set element types: The 'true' tuple has length 1, but the 'false' tuple has length 0.
=== RUN TestExpressionErrorMessages/true_?_mapOf1Tuple_:_mapOf2Tuple
=== RUN TestExpressionErrorMessages/true_?_listOfListOf1Tuple_:_listOfListOf0Tuple
expression_test.go:1997: unexpected success
want error:
Inconsistent conditional result types; The true and false result expressions must have consistent types. At least one deeply-nested attribute or element is not compatible across both the 'true' and the 'false' value.
--- FAIL: TestExpressionErrorMessages (0.00s)
--- PASS: TestExpressionErrorMessages/true_?_1_:_true (0.00s)
--- PASS: TestExpressionErrorMessages/true_?_[1]_:_[true] (0.00s)
--- PASS: TestExpressionErrorMessages/true_?_[1]_:_[1,_true] (0.00s)
--- PASS: TestExpressionErrorMessages/true_?_{_a_=_1_}_:_{_a_=_true_} (0.00s)
--- PASS: TestExpressionErrorMessages/true_?_{_a_=_true,_b_=_1_}_:_{_a_=_true_} (0.00s)
--- PASS: TestExpressionErrorMessages/true_?_{_a_=_true_}_:_{_a_=_true,_b_=_1_} (0.00s)
--- FAIL: TestExpressionErrorMessages/true_?_listOf1Tuple_:_listOf0Tuple (0.00s)
--- FAIL: TestExpressionErrorMessages/true_?_setOf1Tuple_:_setOf0Tuple (0.00s)
--- PASS: TestExpressionErrorMessages/true_?_mapOf1Tuple_:_mapOf2Tuple (0.00s)
--- FAIL: TestExpressionErrorMessages/true_?_listOfListOf1Tuple_:_listOfListOf0Tuple (0.00s)
```

I'm getting it with Go 1.19 (our current default) but also with Go 1.18 (if I'm indeed doing things right, prepending `/usr/lib/go-1.18/bin` to `$PATH`).

Since I'm planning on introducing a new package, I'll probably ignore these three subtests for the time being (it cannot break existing packages), until we've had a chance to figure out what's happening here.

Thanks for your help!

Cheers,
Cyril.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running TestExpressionErrorMessages and inspect expression_test.go around line 1997, focusing on the three conditional-expression cases reported as unexpected successes. Trace the relevant expression type-checking entry point to determine why these mismatches do not produce the expected errors. Done means the affected subtests report the expected messages and the full test passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
compilers, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.