{"action":"created","issue":{"url":"https://api.github.com/repos/ethereum/solidity/issues/4103","repository_url":"https://api.github.com/repos/ethereum/solidity","labels_url":"https://api.github.com/repos/ethereum/solidity/issues/4103/labels{/name}","comments_url":"https://api.github.com/repos/ethereum/solidity/issues/4103/comments","events_url":"https://api.github.com/repos/ethereum/solidity/issues/4103/events","html_url":"https://github.com/ethereum/solidity/issues/4103","id":321521941,"number":4103,"title":"Consider showing a warning when pragma & compiler versions are different","user":{"login":"alex-ppg","id":31933616,"avatar_url":"https://avatars3.githubusercontent.com/u/31933616?v=4","gravatar_id":"","url":"https://api.github.com/users/alex-ppg","html_url":"https://github.com/alex-ppg","followers_url":"https://api.github.com/users/alex-ppg/followers","following_url":"https://api.github.com/users/alex-ppg/following{/other_user}","gists_url":"https://api.github.com/users/alex-ppg/gists{/gist_id}","starred_url":"https://api.github.com/users/alex-ppg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alex-ppg/subscriptions","organizations_url":"https://api.github.com/users/alex-ppg/orgs","repos_url":"https://api.github.com/users/alex-ppg/repos","events_url":"https://api.github.com/users/alex-ppg/events{/privacy}","received_events_url":"https://api.github.com/users/alex-ppg/received_events","type":"User","site_admin":false},"labels":[{"id":275027668,"url":"https://api.github.com/repos/ethereum/solidity/labels/documentation","name":"documentation","color":"006b75","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2018-05-09T10:49:03Z","updated_at":"2018-05-16T12:26:59Z","closed_at":null,"author_association":"NONE","body":"Using a different compiler version than the one specified with the `pragma` keyword can result in unintended behavior as the `pragma` keyword is ambiguous. As such, it would be best to show a **warning** for those who want to heed it and ensure backward compatibility. An example scenario can be found below:\r\n- Which version of Solidity are you using?\r\nThe compiler is running Solidity version 0.4.23.\r\n- What was the source code?\r\n```\r\npragma solidity ^0.4.1;\r\n\r\ncontract StringTest {\r\n    event A();\r\n    \r\n    constructor() public {\r\n        emit A();\r\n    }\r\n}\r\n```\r\n- Which platform are you running on?\r\nIrrelevant.\r\n- How to reproduce the issue?\r\nAttempt to compile the above contract with Solidity 0.4.1.\r\nProceed to compile the above contract with Solidity 0.4.23.\r\n- What was the result of the issue?\r\nThe compiler failed to compile the code with Solidity 0.4.1 but succeeded with version 0.4.23.\r\n- What is the expected behavior?\r\nThe compiler, when writing code using version 0.4.23, should show a **warning** suggesting that you alter your pragma version to match your compiler version.\r\n\r\nThis can be done simply by checking if the `^` keyword exists in `pragma` and if it does check whether the version is lower than the compiler. Showing an ***error*** instead of a ***warning*** would require that the compiler has knowledge of previous versions and available features which would unnecessarily increase its complexity."},"comment":{"url":"https://api.github.com/repos/ethereum/solidity/issues/comments/389500279","html_url":"https://github.com/ethereum/solidity/issues/4103#issuecomment-389500279","issue_url":"https://api.github.com/repos/ethereum/solidity/issues/4103","id":389500279,"user":{"login":"axic","id":20340,"avatar_url":"https://avatars3.githubusercontent.com/u/20340?v=4","gravatar_id":"","url":"https://api.github.com/users/axic","html_url":"https://github.com/axic","followers_url":"https://api.github.com/users/axic/followers","following_url":"https://api.github.com/users/axic/following{/other_user}","gists_url":"https://api.github.com/users/axic/gists{/gist_id}","starred_url":"https://api.github.com/users/axic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/axic/subscriptions","organizations_url":"https://api.github.com/users/axic/orgs","repos_url":"https://api.github.com/users/axic/repos","events_url":"https://api.github.com/users/axic/events{/privacy}","received_events_url":"https://api.github.com/users/axic/received_events","type":"User","site_admin":false},"created_at":"2018-05-16T12:26:59Z","updated_at":"2018-05-16T12:26:59Z","author_association":"MEMBER","body":"> The problem is not limited to the emit keyword. You can use pragma solidity ^0.4.0 and it will still allow you to use all features of 0.4.24 such as the constructor() identifier or a message with the require keyword. A warning definitely needs to be added during compilation.\r\n\r\nI am getting the feeling that what you actually need is a module in the Remix static analyzer (cc @soad003) which suggests the correct minimum version after considering all the language features used in the given snippet."}}
{"actor":{"display_login":"axic"}}