-
-
Notifications
You must be signed in to change notification settings - Fork 661
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package cases.display.issues; | ||
|
||
import haxe.Json; | ||
import haxe.display.Display; | ||
|
||
private typedef HoverResponse = { | ||
?error:{code:Int, message:String}, | ||
?result:HoverResult | ||
} | ||
|
||
class Issue11892 extends DisplayTestCase { | ||
function testCompilerMetadata(_) { | ||
var content = getTemplate("issues/Issue11892/Main.hx"); | ||
var transform = Marker.extractMarkers(content); | ||
vfs.putContent("Main.hx", transform.source); | ||
|
||
var args = ["--main", "Main", "-D", "analyzer-optimize", "--interp", "--dce=full"]; | ||
// Needed to repro -4- | ||
args = args.concat(["-D", "disable-hxb-cache"]); | ||
runHaxe(["--no-output"].concat(args)); | ||
|
||
// Previously was pointing to @:pure | ||
runHaxeJson(args, DisplayMethods.Hover, {file: new FsPath("Main.hx"), offset: transform.markers[1]}); | ||
var response:HoverResponse = Json.parse(lastResult.stderr); | ||
Assert.equals(null, response.error); | ||
Assert.equals(null, response.result.result); | ||
|
||
runHaxe(["--no-output"].concat(args)); | ||
|
||
// Previously was pointing to @:value | ||
runHaxeJson(args, DisplayMethods.Hover, {file: new FsPath("Main.hx"), offset: transform.markers[2]}); | ||
var response:HoverResponse = Json.parse(lastResult.stderr); | ||
Assert.equals(null, response.error); | ||
Assert.equals(null, response.result.result); | ||
|
||
runHaxe(["--no-output"].concat(args)); | ||
|
||
// Previously was pointing to @:pure(expect) | ||
// But previously was also giving an error.. | ||
runHaxeJson(args, DisplayMethods.Hover, {file: new FsPath("Main.hx"), offset: transform.markers[3]}); | ||
var response:HoverResponse = Json.parse(lastResult.stderr); | ||
Assert.equals(null, response.error); | ||
Assert.equals(null, response.result?.result); | ||
|
||
runHaxe(["--no-output"].concat(args)); | ||
|
||
// Previously was pointing to @:directlyUsed | ||
runHaxeJson(args, DisplayMethods.Hover, {file: new FsPath("Main.hx"), offset: transform.markers[4]}); | ||
var response:HoverResponse = Json.parse(lastResult.stderr); | ||
Assert.equals(null, response.error); | ||
Assert.equals(null, response.result.result); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
class Main { | ||
static function main():Void { | ||
var pure {-1-}= 42; | ||
} | ||
|
||
var value = { | ||
var y {-2-}= 42; | ||
0; | ||
}; | ||
} | ||
|
||
class Foo { | ||
@:pure function foo() {} | ||
} | ||
|
||
class PureExpect extends Foo { | ||
override final function foo() { | ||
var y {-3-}= 42; | ||
} | ||
|
||
function baz() trace(DirectlyUsedEnum); | ||
} | ||
|
||
enum DirectlyUsedEnum { | ||
Foobar(a:Int {-4-}, b:Int); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--main Main1a | ||
--interp |