New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Range operator with char returns unexpected value #5731

Closed
stknohg opened this Issue Dec 21, 2017 · 4 comments

Comments

Projects
None yet
4 participants
@stknohg
Contributor

stknohg commented Dec 21, 2017

Steps to reproduce

[char]'a'..[char]'e'

Expected behavior

# Char array ([char]'a', [char]'b', [char]'c', [char]'d', [char]'e')
a
b
c
d
e

Actual behavior

# Int array (97, 98, 99, 100, 101)
97
98
99
100
101

Environment data

> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      6.0.0-rc.2
PSEdition                      Core
GitCommitId                    v6.0.0-rc.2
OS                             Microsoft Windows 10.0.15063
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

@iSazonov iSazonov referenced this issue Dec 21, 2017

Merged

Fix range operator #5732

6 of 7 tasks complete

@iSazonov iSazonov self-assigned this Dec 26, 2017

@FireInWinter

This comment has been minimized.

Show comment
Hide comment
@FireInWinter

FireInWinter Jan 3, 2018

Oddly the actual behavior matches Windows PowerShell results. So changing this might break a few scripts that otherwise might work when on PowerShell 6.
I still think it should be modified to give the expected results, but wanted to call out that [char]'a'..[char]'e' did work in previous versions of PowerShell by returning 97-101.

FireInWinter commented Jan 3, 2018

Oddly the actual behavior matches Windows PowerShell results. So changing this might break a few scripts that otherwise might work when on PowerShell 6.
I still think it should be modified to give the expected results, but wanted to call out that [char]'a'..[char]'e' did work in previous versions of PowerShell by returning 97-101.

@iSazonov

This comment has been minimized.

Show comment
Hide comment
@iSazonov

iSazonov Jan 4, 2018

Collaborator

@FireInWinter Thanks! I'll label the fix as Breaking change.

Collaborator

iSazonov commented Jan 4, 2018

@FireInWinter Thanks! I'll label the fix as Breaking change.

@nightroman

This comment has been minimized.

Show comment
Hide comment
@nightroman

nightroman Jan 4, 2018

Is it a bug at all? The operator casts operands to integers and then increments. The result is integers. This looks fine (to me).

What about 1.1 .. 9.1? Should it work with doubles or not?

nightroman commented Jan 4, 2018

Is it a bug at all? The operator casts operands to integers and then increments. The result is integers. This looks fine (to me).

What about 1.1 .. 9.1? Should it work with doubles or not?

@iSazonov

This comment has been minimized.

Show comment
Hide comment
@iSazonov

iSazonov Jan 4, 2018

Collaborator

It is bug for PowerShell Core not for Windows PowerShell. Windows PowerShell support only [Int]. PowerShell Core support [char].
It would works with doubles if doubles had an enumerator.

Collaborator

iSazonov commented Jan 4, 2018

It is bug for PowerShell Core not for Windows PowerShell. Windows PowerShell support only [Int]. PowerShell Core support [char].
It would works with doubles if doubles had an enumerator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment