Skip to content

Exessive long warning message #1838

@Rathoz

Description

@Rathoz

How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

Windows

What is the issue affecting?

Type Checking

Expected Behaviour

Getting only this warning

This variable is defined as type `string`. Cannot convert its type to `nil`.
- `nil` cannot match `string`
- `nil` cannot match any subtypes in `string`

Actual Behaviour

Getting this beauty
image

Reproduction steps

local Countries = require('countries')
local str = Countries.CountryName('dummy')
str = nil

Return value of .CountryName is automatically inferred to by the Intellisense to:

""|"Afghanistan"|"Africa"|"Albania"|"Algeria"|"American Samoa"|"Andorra"|"Angola"|"Anguilla"|"Antarctica"|"Antigua and Barbuda"|"Argentina"|"Armenia"|"Aruba"|"Ascension Island"|"Asia"|"Asia-Pacific"|"Australia"|"Austria"|"Azerbaijan"|"Bahamas"|"Bahrain"|"Bangladesh"|"Barbados"|"Belarus"|"Belgium"|"Belize"|"Benelux"|"Benin"|"Bermuda"|"Bhutan"|"Bolivia"|"Bonaire, Sint Eustatius and Saba"|"Bosnia and Herzegovina"|"Botswana"|"Bouvet Island"|"Brazil"|"British Indian Ocean Territory"|"Brunei"|"Bulgaria"|"Burkina Faso"|"Burundi"|"CIS"|"Cabo Verde"|"Cambodia"|"Cameroon"|"Canada"|"Cayman Islands"|"Central African Republic"|"Central America"|"Central Asia"|"Chad"|"Chile"|"China"|"Christmas Island"|"Cocos (Keeling) Islands"|"Colombia"|"Comoros"|"Congo"|"Cook Islands"|"Costa Rica"|"Croatia"|"Cuba"|"Curaçao"|"Cyprus"|"Czechia"|"Côte d'Ivoire"|"Democratic Republic of the Congo"|"Denmark"|"Djibouti"|"Dominica"|"Dominican Republic"|"East Asia"|"Ecuador"|"Egypt"|"El Salvador"|"England"|"English Speaking"|"Equatorial Guinea"|"Eritrea"|"Estonia"|"Eswatini"|"Ethiopia"|"Europe"|"Falkland Islands"|"Faroe Islands"|"Federated States of Micronesia"|"Fiji"|"Finland"|"France"|"French Guiana"|"French Polynesia"|etc...

Additional Notes

No response

Log File

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions