警告scala 2.11中的名称阴影

时间:2016-01-05 22:58:38

标签: scala compiler-warnings compiler-flags

我正在使用SBT构建项目并拥有Build.scala

scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature", "-Xfatal-warnings")

如何配置项目以警告名称/变量阴影?我已经浏览了来源herehere,但没有看到我在众多选项中寻找的内容。对this old question的评论提到了一个似乎不存在的标记-Ywarn-shadowing

2 个答案:

答案 0 :(得分:1)

related question所示,您可以开始使用{ "resort": [ { "id":"resort1", "destination":"Carribean", "name":"Les Boucaniers", "location":"Martinique", "comfortLevel": "4", "activities":["water skiing", "tennis", "scuba diving", "kitesurf", "spa"], "price":1254, "startDate":"2016-01-01", "endDate":"2016-12-31", "short_description":"The resort of Les Boucaniers is located on the laid-back beach-covered south coast of the island, and is perfectly placed for Martinique holidays that are both relaxing and awe-inspiring.", "picture":"images/resort1pic1small.jpg", "long_description":"A divers' paradise in the Baie du Marin, a legendary spot.<br>Its bungalows are discreetly lodged in a tropical garden beside the white sand beach in superb Marin Bay. A magical site where you can enjoy a taste of everything, alone or with family or friends. Try water sports and the magnificent Club Med Spa*. You'll be enchanted by the exotic flavours of the local cuisine and the joyful spirit of the Caribbean.", "url":"resorts/resort1.html" }, { "id":"resort2", "destination":"Indian Ocean", "name":"La Plantation d'Albion", "location":"Mauritius", "comfortLevel": "5", "activities":["kids club","golf", "scuba diving", "flying trapeze", "tennis", "sailing", "spa"], "price":2062, "startDate":"2016-01-01", "endDate":"2016-12-31", "short_description":"Beautifully located in one of the last remote creeks on the island, La Plantation d'Albion Club Med welcomes the most demanding of guests into a world of supreme refinement.", "picture":"images/resort2pic1small.jpg", "long_description":"In a remote beauty spot, savour the luxury of Mauritian lifestyle. <br> The idyllic natural setting is enhanced by the sublime decor designed by Marc Hertrich and Nicolas Adnet, and the Resort's top-end comfort is perfectly reflected in its beautifully spacious rooms. The exceptional CINQ MONDES Spa* and luxurious overflow pool add an ideally Zen touch.<br> The Resort is entirely devoted to fulfilling its guests' desires and offers discreet, personal service in its swimming areas, bars and 'Table Gourmet' restaurants.", "url":"resorts/resort2.html" } ]} 进行探索。然后我尝试了-X,这会产生阴影的一些设置:

-Xlint:help

你可能想要Information:scalac: Enable or disable specific warnings adapted-args Warn if an argument list is modified to match the receiver. nullary-unit Warn when nullary methods return Unit. inaccessible Warn about inaccessible types in method signatures. nullary-override Warn when non-nullary `def f()' overrides nullary `def f'. infer-any Warn when a type argument is inferred to be `Any`. missing-interpolator A string literal appears to be missing an interpolator id. doc-detached A ScalaDoc comment appears to be detached from its element. private-shadow A private field (or class parameter) shadows a superclass field. type-parameter-shadow A local type parameter shadows a type already in scope. poly-implicit-overload Parameterized overloaded implicit methods are not visible as view bounds. option-implicit Option.apply used implicit view. delayedinit-select Selecting member of DelayedInit. by-name-right-associative By-name parameter of right associative operator. package-object-classes Class or object defined in package object. unsound-match Pattern match may not be typesafe. stars-align Pattern sequence wildcard must align with sequence component. 吗?

答案 1 :(得分:1)

有许多scala linter工具。 Scapegoat可以选择 @foreach (var item in Model) { <tr> <td> @Ajax.ActionLink(" Delete", "", "", new { id = @item.UserProfileID }, new AjaxOptions() { HttpMethod = "GET", InsertionMode = InsertionMode.InsertAfter, UpdateTargetId = "", OnSuccess = "ShowModal()" }, new { @class = "fa fa-times btn btn-danger btn-xs", @id = "bt_del_profile" }) </td> </tr> } <div id="myModal" aria-hidden="true" class="modal fade"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-footer"> <button type="button" id="bt_del_ok" class="btn btn-success btn-sm">Ok</button> </div> </div> </div> </div> <script type="text/javascript"> function ShowModal() { $("#myModal").modal('show'); } $('#bt_del_ok').click(function (e) { e.preventDefault(); $.ajax({ url: '/Profile/DelProfile', type: 'POST', contentType: 'application/json; charset=utf-8', dataType: 'json', cache: false, //processData: false, data: { id: @item.UserProfileID }, success: function (result) { alert("OK"); }, error: function (result) { alert("Error delete"); } }); }); </script> 。我没有在更受欢迎的短片中看到阴影选项,但你可以自己实现一个。