Skip to content

Commit

Permalink
Add more error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
peachpit-site committed Jan 31, 2025
1 parent 90b5223 commit e2086ce
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
2 changes: 1 addition & 1 deletion source/compiler/compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -2288,7 +2288,7 @@ func (cp *Compiler) EmitTypeChecks(loc uint32, types AlternateType, env *Environ
acceptedSingles = singles.intersect(cp.getTypes(sig, 0))
}
checkSingleType := bkGoto(DUMMY)
if len(singles) == 0 && sig.Len() != 1 {
if len(singles) == 0 && sig.Len() == 1 {
cp.P.Throw("comp/typecheck/values/a", tok)
return errorCheck
}
Expand Down
12 changes: 1 addition & 11 deletions source/err/errorfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -1000,16 +1000,6 @@ var ErrorCreatorMap = map[string]ErrorCreator{
},

"comp/typecheck/values/a": {
Message: func(tok *token.Token, args ...any) string {
return "type error"
},
Explanation: func(errors Errors, pos int, tok *token.Token, args ...any) string {
return "The typechecker has determined that this condition can never be " +
"fulfilled by your code as written."
},
},

"comp/typecheck/values/b": {
Message: func(tok *token.Token, args ...any) string {
return "trying to assign multiple values to non-tuple type"
},
Expand All @@ -1020,7 +1010,7 @@ var ErrorCreatorMap = map[string]ErrorCreator{
},
},

"comp/typecheck/values/c": {
"comp/typecheck/values/b": {
Message: func(tok *token.Token, args ...any) string {
return "wrong number of arguments"
},
Expand Down

0 comments on commit e2086ce

Please sign in to comment.